Nested function returning a variable through the outer function in python : <p>I have a requirement which I am going to try an explain through the below example:</p>

<p>Suppose we have a segment of code like this:</p>

<pre><code>def a:
    def b:
        x = 2 
</code></pre>

<p>Now I want to return x through the function a. Is there any way to do it in python?</p>
