Symbols as parameters?
george.sakkis at gmail.com
Mon Jan 25 01:46:08 CET 2010
On Jan 25, 1:05 am, Steven D'Aprano
<ste... at REMOVE.THIS.cybersource.com.au> wrote:
> On Sun, 24 Jan 2010 10:11:07 -0800, George Sakkis wrote:
> > Both in your example and by using a context manager, you can get away
> > with not passing locals() explicitly by introspecting the stack frame.
> You say that as if it were less of an ugly hack than the locals() trick.
> But sys._getframe is a private implementation detail, so you're no better
The client *is* better off in that he doesn't have to pass locals() to
some magic decorator to achieve his goal; how this is implemented is a
different issue. As for being an ugly hack, you may use inspect.stack
() if the underscore in sys._getframe() makes you feel dirty.
More information about the Python-list