[ZODB-Dev] Typechecking oid in getitem
Jeremy Hylton
jeremy at zope.com
Mon May 19 16:46:21 EDT 2003
On Mon, 2003-05-19 at 11:34, Toby Dickenson wrote:
> On Monday 19 May 2003 4:22 pm, Christian Reis wrote:
> > On Mon, May 19, 2003 at 10:59:28AM -0400, Jeremy Hylton wrote:
> > > The type of an oid depends on the storage, so there is no guarantee that
> > > it will be a string. In fact, ZODB4 storages will soon change to using
> > > Python longs.
>
> Longs as a better type for holding the same old 64 opaque bits?
Yes, except that internally the 64 opaque bits are a counter that starts
at zero. So you don't start using most of those bits until there are a
lot of oids generate.
A Python long that uses no more than 30 bits fits in 16 bytes. An
8-byte string requires 28 bytes and will actually be stored in 32 bytes
because of pymalloc rounding.
Jeremy
More information about the ZODB-Dev
mailing list