a dummy python question
Learning Python
learningProgramming at gmail.com
Thu Aug 25 17:29:30 EDT 2005
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.
but I typed in this in python interface. It works!
it print out:
3 2 1 0
If you turn this into a module file and run this
it print out
3 2 1 0 none
Can anyone explain to me what's going on?
Thanks
BTW: I am using Python 2.3
More information about the Python-list
mailing list