In message <mailman.1218.1285868424.29448.python-l...@python.org>, MRAB wrote:
> An alternative is to create a namespace in an instance of a class and > then add attributes to it: > > class Namespace(object): > pass > > n = Namespace() > for v in ('spam', 'ham', 'eggs'): > setattr(n, v, init(v)) > > foo(n.spam) > bar(n.ham) > baz(n.eggs) I’d add my vote to this. If you want to hack a namespace, make your own, don’t try to mess with the unqualified local or global namespaces. And as above, you can use a short prefix to save typing. -- http://mail.python.org/mailman/listinfo/python-list