I saw this and tried to use it: ------------------><8------------------- const.py------------- class _const: class ConstError(TypeError): pass def __setattr__(self,name,value): if self.__dict__.has_key(name): raise self.ConstError, "Can't rebind const(%s)"%name self.__dict__[name]=value
import sys sys.modules[__name__]=_const() ------------------><8------------------- const.py------------- Then when I go to try to use it I'm supposed to say: const.pi = 3.14159 const.e = 2.7178 Two questions: 1. Why do I not have to say _const.pi = 3.14159 _const.e = 2.7178 and is this in the tutorial? 2. Can I make this behave in such a way that I can create my constants with a classname that is different for different uses? e.g., irrational_const.pi = 3.14159 irrational_const.e = 2.7178 even_const.first = 2 even_const.firstPlus = 4 TIA -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Does your driver's license say Organ ..0 Donor?Black holes are where God divided by zero. Listen to me! We are all- 000 individuals! What if this weren't a hypothetical question? steveo at syslang.net -- http://mail.python.org/mailman/listinfo/python-list