[Persistence-sig] "Straw Baby" Persistence API
Steve Menard
smenard@bigfoot.com
Mon, 22 Jul 2002 10:26:18 -0400
At 10:05 AM 7/22/2002 -0400, Jeremy Hylton wrote:
> >>>>> "GvR" == Guido van Rossum <guido@python.org> writes:
>
> >> * I do think we should keep PersistentList and PersistentMapping
> >> in the
> >> core; they're useful for almost any kind of application, and any
> >> kind of back-end storage. They don't introduce policy or data
> >> format dependencies into users' code, either.
>
> GvR> But perhaps these should be rewritten to derive from dict and
> GvR> list instead of UserDict and UserList?
>
>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.
>
>Jeremy
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.
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.
Steve