What are enclosing functions?
<p>According to <a href="http://docs.python.org/tutorial/controlflow.html" rel="nofollow">the python tutorial</a>, functions look for variable names in the symbol tables of enclosing functions before looking for global functions: </p>

<blockquote>
  <p>The execution of a function introduces a new symbol table used for the local variables of the function. More precisely, all variable assignments in a function store the value in the local symbol table; whereas variable references first look in the local symbol table, then in the local symbol tables of enclosing functions, then in the global symbol table, and finally in the table of built-in names. Thus, global variables cannot be directly assigned a value within a function (unless named in a global statement), although they may be referenced.</p>
</blockquote>

<p>What exactly does "enclosing function" mean, and when is it used?</p>

<p>I see the following code prints 10 when called</p>

<pre><code>def parent_function():
    y=10
    def child_function():
        print y
    child_function()
</code></pre>

<p>However, calling child_function() alone produces an error. Are enclosing functions used frequently? </p>
