"greg" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> There's a problem with that when you want to subclass:
Agreed. The following addresses that and, I think, some
of the other objections that have been raised.
Alan
class Lockable:
a = 0
def __init__(self, lock=False):
self.b = 1
self.lock = lock
def __setattr__(self, attr, val):
if not hasattr(self,attr) and hasattr(self,'lock') and self.lock:
raise ValueError("This object accepts no new attributes.")
self.__dict__[attr] = val
--
http://mail.python.org/mailman/listinfo/python-list