__slots__

Alex Martelli aleaxit at yahoo.com
Fri Nov 7 18:52:51 EST 2003


flori wrote:

> i try to greate somthing like this
> 
> class ca(object): __slots__ = ("a",)
> class cb(ca): __slots__ = ("a","b")
> class cc(ca): __slots__ = ("a","c")
> class cd(cb,cc): __slots__ = ("a","b","c","d")
> 
> but i didn't find a simple solution

...for WHAT problem...?

>>> class ca(object): __slots__ = 'a',
...
>>> class cb(ca): __slots__ = 'b',
...
>>> xx=cb()
>>> xx.a=23
>>>

slots are inherited... is this perhaps what was unclear to you?


Alex





More information about the Python-list mailing list