Accessing nested functions for testing

Chad Netzer cnetzer at mail.arc.nasa.gov
Mon May 19 23:39:27 EDT 2003


Is there any way to access a nested function as though it were not
nested (ie. for testing it directly)?

For example:

def foo():
    def bar():
        pass
    bar()

Is it possible to execute bar from outside of foo?  I can't even find a
way to see or access bar at all, from the global scope.

My intuition says this is not possible, I'm just curious if that is
truly the case.

Thanks.

-- 

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)






More information about the Python-list mailing list