I defined a nested function:
def foo():
def bar():
return "bar"
return "foo " + bar()
which works. Knowing how Python loves namespaces, I thought I could do
this:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'function' object has no attribute 'bar'
but it doesn't work as I expected.
where do nested functions live? How can you access them, for example, to
read their doc strings?
--
Steven.
def foo():
def bar():
return "bar"
return "foo " + bar()
which works. Knowing how Python loves namespaces, I thought I could do
this:
>>foo.bar()
File "<stdin>", line 1, in ?
AttributeError: 'function' object has no attribute 'bar'
but it doesn't work as I expected.
where do nested functions live? How can you access them, for example, to
read their doc strings?
--
Steven.
Comment