[Persistence-sig] "Straw Baby" Persistence API
Kevin Jacobs
jacobs@penguin.theopalgroup.com
Mon, 22 Jul 2002 10:59:36 -0400 (EDT)
On Mon, 22 Jul 2002, Steve Menard wrote:
> At 10:05 AM 7/22/2002 -0400, Jeremy Hylton wrote:
> >One small comment. (I owe more substantial comment on Phillip's
> >earlier proposals.) The persistent versions of dict and list can't
> >extend the builtin types, because they need to hook __getitem__() and
> >__setitem__(). The overridden methods may not be called if we extend
> >the builtin types.
>
> hum, if those method are not guaranteed to be called by subclassing dict or
> list, then there is something broken. Either that or there is a subtle
> thing I do not understand.
In fact, I am quite sure that one can inherit from list or dict and override
__getitem__ and __setitem__ in a cooperative fashion. Can you provide a
little more information on why you think otherwise?
> 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?
Thanks,
-Kevin
--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com
Fax: (216) 986-0714 WWW: http://www.theopalgroup.com