Re: __getattribute__ and __slots__

2006-04-17 Thread Peter Otten
[EMAIL PROTECTED] wrote: Python has both __getattribute__() and __getattr__(). While __getattribute__() will always be called if you ask for an attribute __getattr__() serves only as fallback if the attribute if not found by other means. > I try to define a (new-style) class who: > - have a __slo

__getattribute__ and __slots__

2006-04-14 Thread pascal . parent
Hi, I try to define a (new-style) class who: - have a __slots__ defined to be strict attributes, - return None if the attribute is 'ok' but not set, or raise a 'normal' error if the attribute isn't in __slots__. This code runs, but is it the good way? Thanks. class test(object): __slots__ =