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:

>>> foo.bar()
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.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to