Symbols as parameters?

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Mon Jan 25 01:05:13 CET 2010


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 
off.


> So it's utility is pretty limited; a custom DSL is probably better
> suited to your problem.

Personally, I think the OP is worrying too much about namespace 
pollution. If you're concerned about the enums of one function clashing 
with the enums of another, that's a strong hint that they don't belong in 
the same module.



-- 
Steven



More information about the Python-list mailing list