a dummy python question

infidel saint.infidel at gmail.com
Thu Aug 25 17:53:32 EDT 2005


Learning Python wrote:
> A example in learning Python by Mark Lutz and David Ascher
>
> about function scope
>
> example like this:
>
> >>def outer(x):
>      def inner(i):
>         print i,
>         if i: inner(i-1)
>      inner(x)
> >>outer(3)
>
> Here supposely, it should report error, because the function inner
> cannot see itself since inner is only in local namespace of outer.

If that were so, Pythonistas could never write a recursive function!




More information about the Python-list mailing list