getting caller
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Feb 12 22:05:32 EST 2009
En Thu, 12 Feb 2009 19:26:26 -0200, Hamish McKenzie
<hamish at valvesoftware.com> escribió:
> so I'm trying to wrap some functionality around execfile but don't want
> to modify the way it works. specifically when you call execfile, it
> automatically grabs globals and locals from the frame the execfile
> exists in.
>
> so if I wrap execfile in a function, I need a way to reliably get at the
> calling frame.
Instead of doing that, just pass the desired namespaces to be used; you'll
want to use locals() and globals() for that.
--
Gabriel Genellina
More information about the Python-list
mailing list