Eval cannot see globals from another module
Tom Harris
tom.harris at setec.com.au
Tue Aug 17 00:11:40 EDT 2010
Greetings,
I want a debugging function with the effect of the function below (in a
seperate module):
def dump(expr):
print expr, '=', eval(expr)
foo = 33
dump('foo')
Of course this fails when called from another module because eval does not
know the globals or locals of the caller. Is there a way to make this work?
TomH
--------
Email from setec.com.au does not necessarily represent the official
policy of SETEC Pty Ltd.
See http://www.setec.com.au/emaildisclaimer20060629.html for details.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100817/1fe6be53/attachment.html>
More information about the Python-list
mailing list