Eliminate __dict__ from persistent btree, bnode,
dict, list and set
Mike Orr
2006-07-05
On 7/5/06, Patrick K. O'Brien wrote:
> Mike Orr wrote:
> > On 7/5/06, David Binger wrote:
> >> Just the other day,
> >> someone asked
> >> me if it was safe to assign attributes to a PersistentDict: it is,
> >> as long
> >> as you avoid "data" and the other inherited names. Your change would
> >> change the answer from "yes, with care" to "no". I bet that does break
> >> some existing code.
> >
> > I asked about this, so I can put attributes on the root object.
> > root.chemicals[1234].name makes more sense than
> > root["chemicals"][1234].name, when the number of attributes is few and
> > relatively fixed.
>
> In this case I think the memory saving far outweigh the syntactical
> nicety that you have achieved.
There's no reason the root class has to be a PersistentDict.
PersistentDict could be made slotted, and the root object a special
subclass that supports attribute assignment.
--
Mike Orr