"Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > If you want to restrict attribute asignment, you should use the > __setattr__ special method, see: > http://docs.python.org/ref/attribute-access.html
That "should" is what I am asking about. If I understand, in the simplest case, you want me to say something like def __setattr__(self,name,value): if name in myattrlist: object.__setattr__(self,name,value) else: raise AttributeError instead just saying __slots__ = myattrlist I understand that this *is* the prevailing advice. But why? > >>> class A(object): > ... pass > ... > >>> class B(A): > ... __slots__ = ('spam',) > ... > >>> b = B() > >>> b.eggs = 1 > >>> b.eggs > 1 A good example of something that could be easily missed, and possibly an answer to my question above. (Although not I think if I am subclassing object.) Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list