[Python-Dev] builtin_id() returns negative numbers
Tim Peters
tim.peters at gmail.com
Thu Feb 17 19:44:11 CET 2005
[Tim Peters]
>> # This is a puzzle: there's no way to know the natural width of
>> # addresses on this box (in particular, there's no necessary
>> # relation to sys.maxint).
[Armin Rigo]
> Isn't this natural width nowadays available as:
>
> 256 ** struct.calcsize('P')
>
> ?
Looks right to me -- cool! I never used struct's 'P' format because
it always appeared useless to me: even if I could ship pointers
across processes or boxes, there's not much I could do with them after
getting integers back from unpack(). But silly me! I'm sure Guido
put it there anticipating the need for calcsize('P') when making a
positive_id() function in Python.
Now if you'll just sign and fax a Zope contributor agreement, I'll
upgrade ZODB to use this slick trick <wink>.
More information about the Python-Dev
mailing list