Variable lookup in calling context

Stefan Franke franke at ableton.com
Tue Sep 16 13:36:49 EDT 2003


To access a calling function's locals I can use sys._getframe(1).f_locals.
But how do I perform a full variable lookup in the context of the caller
as if it happened there - including all surrounding scopes?

(BTW: Is inspect.currentframe preferable over sys._getframe?)

Stefan





More information about the Python-list mailing list