Multiple inheritance and __slots__

jm.suresh@no.spam.gmail.com jm.suresh at gmail.com
Thu Dec 14 08:23:33 EST 2006


Hi all,
>From the google search, it seems its not possible to do the following.

>>> class Test1(object):
...     __slots__ = ['a']
...
>>> class Test2(object):
...     __slots__ = ['b']
...
>>> class Test3(Test1,Test2):
...     __slots__ = ['c']
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Error when calling the metaclass bases
    multiple bases have instance lay-out conflict

I just want to make sure that I am using only the attributes a,b and c
from the instances of Test3 . Is there any other hack that could be
done.

--
Suresh




More information about the Python-list mailing list