Eliminate __dict__ from persistent btree, bnode,
dict, list and set
David Binger
2006-07-06
On Jul 5, 2006, at 7:59 PM, Patrick K. O'Brien wrote:
>
> I have one idea. Instead of PersistentDict.data being a dict, it
> could
> be a subclass of dict. Then __setstate__ could test the incoming
> state
> to see if it is a regular dict or our special subclass. But that
> would
> trade off physical disk savings against type inspection within
> __setstate__, which gets called a lot. I'm not sure that would be
> worthwhile. The alternative would be a one-time conversion routine.
> Unless you think of something better.
It does not help PersistentSet or PersistentList as your idea does,
but it might be possible to make PersistentDict use the actual __dict__
value as the dict instead of wrapping another dict instance.
I think I remember trying to make PersistentDict be a dict as you
suggest here, and I felt like it was getting difficult to understand.