On 27 Feb, 06:40, "Alan Isaac" <[EMAIL PROTECTED]> wrote:
> So my question remains:
> how best to trap any such attempt
> subsequent to object initialization?
> (I am willing to have properties for
> all data attributes, if that helps.)
>
You can define the __setattr__ method in your class as
def __setattr__(self, attr, val):
if hasattr(self, attr):
self.__dict__[attr] = val
else:
# Tell the user off
but of course the user can set attributes through
instance.__dict__['attrname'] = val
So to really do it you would need to design your own metaclass
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list