Sean DiZazzo skrev:
I would do something like this:

class Namespace(object):
...     pass
...
n = Namespace()
n.f = 2
n.g = 4
print f
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'f' is not defined
print n.f
2

I like this solution. This also minimizes the extra code if I would want to explicitly delete the bindings, as I would only need one line to delete the Namespace object.

Thanks!

Johan

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to