> > If that were so, Pythonistas could never write a recursive function!
>
> No, presumably at the writing of the edition of _Learning Python_ that
> he is reading, Python did not have nested scopes in the language, yet.
> One could always write a recursive function provided it was at the
> top-lev
Thanks all for replying.
I finally know what's going on.
--
http://mail.python.org/mailman/listinfo/python-list
infidel wrote:
> 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
Learning Python wrote:
>>>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.
There is no er
This is not reproducible under either Python 2.3.4 (UNIX), Python 2.4.1
(UNIX) or Python 2.4.1 (Windows). If you still need help, we need to
know precisely what you're doing.
= scope_test.py =
#!/usr/bin/env python
#
# (insert his code, verbatim...)
#
if __name__=='__main__':
outer(3)
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, becaus