"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] class Difficult(object): def __setattr__(self, name, value): if self.__dict__.has_key(name): print "'%s' exists as an instance attribute" % name self.__dict__[name] = value elif self.__class__.__dict__.has_key(name): print "'%s' exists as a class attribute" % name self.__class__.__dict__[name] = value else: print "Can't create new attributes, 'cos I said so!"
But this prevents setting attributes during initialization, so it does not meet the spec. Cheers, Alan -- http://mail.python.org/mailman/listinfo/python-list