[Persistence-sig] "Straw Baby" Persistence API
Jeremy Hylton
jeremy@alum.mit.edu
Mon, 22 Jul 2002 11:50:41 -0400
>>>>> "SM" == Steve Menard <smenard@bigfoot.com> writes:
>> > On a side note, as I have said in another post, I have done
>> > exactly that, subclassing dict and list. While my model didn't
>> > need to override __getitem__(), the __setitem__() at least
>> > seemed to act properly. In fact the only problem I have found
>> > is that it was not possible to mix __slots__ and dict/list.
>>
>> For all strange and perverse things I've done, slots work just
>> fine when inheriting from list and dict. Again, can you provide
>> an example of where you found otherwise?
SM> Ok, my problem was from inheriting both from dict and from my
SM> Persistent class. Persistent was using slots. I could dig out or
SM> reproduce error message if you're interested.
dict and Persistent are not compatible at the C level. That's a
second problem, and one that I hadn't thought of. (It doesn't have
anything to do with slots.)
>>> class PD(Persistent, dict):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: multiple bases have instance lay-out conflict
There's no way to make this problem go away if we continue to
implement persistence in C.
Jeremy