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 -- http://mail.python.org/mailman/listinfo/python-list