[ZODB-Dev] oids, numbers, hex and 8-byte strings
Chris Withers
chris at simplistix.co.uk
Fri Oct 21 10:17:33 EDT 2005
Tim Peters wrote:
> You found ZODB.utils, which was a sensible place to look. I don't really
> understand how you found ZODB.utils but didn't manage to find p64, because
> p64 is the first function in the file.
Because its name means nothing to me...
>>I guess p64 needs documenting,
>
> I think its docstring is reasonably clear:
>
> def p64(v):
> """Pack an integer or long into a 8-byte string"""
Yes, but for that to be meaningful, you have to know that:
- 0xSomething is an integer or long (it read "hex number" in my head"
- oids are 8-byte strings
Neither of things that sit in my brain :-(
> In addition to that, it would be helpful to have a tutorial overview
> "somewhere" explaining that FileStorage oids are 8-byte strings. I don't
> know where to put that so that people would find it, though. For example,
> where would you have found it?
howtoturnnumbersintooids.txt :-S
I dunno, readme.txt? reference.txt?
>>and maybe a better name?
>
>
> Many ZODB users already know this, and there are references to p64 on user
> web pages. For example,
>
> http://www.zopezone.com/discussions/general/00000168
>
> shows how to do what you started out to do:
>
>
>>>>from Zope.Startup.run import configure;configure('zope-8000/zope.conf')
>>>>from Zope import app; root = app()
>>>>from ZODB.utils import p64
>>>>o = root._p_jar[p64(0x277FEL)]
>>>>o
>
> OOBucket([('566', -1920968609), ...])
Indeed, Google failed me *sigh*
> I don't want to break pages like that, so the current name has to remain.
Absolutely.
> It would be possible to add an alias. I'm -0 on that (would violate TOOWTDI
> in exchange for ... well, not sure it would really help anyone anyway).
TOOWTDI?
It might help some people (would have helped me ;-) ) and would it hurt
anyone?
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the ZODB-Dev
mailing list