[Python-Dev] builtin_id() returns negative numbers (original) (raw)
James Y Knight foom at fuhm.net
Mon Feb 14 17:33:13 CET 2005
- Previous message: [Python-Dev] builtin_id() returns negative numbers
- Next message: [Python-Dev] builtin_id() returns negative numbers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Feb 14, 2005, at 10:41 AM, Tim Peters wrote:
Wouldn't it be more elegant to make builtinid() return an unsigned long integer? I think so. This is the function ZODB 3.3 uses, BTW: def positiveid(obj): """Return id(obj) as a non-negative integer.""" [...]
I think it'd be nice to change it, too. Twisted also uses a similar function.
However, last time this topic came up, this Tim Peters guy argued against it. ;)
Quoting http://mail.python.org/pipermail/python-dev/2004-November/050049.html:
Python doesn't promise to return a postive integer for id(), although it may have been nicer if it did. It's dangerous to change that now, because some code does depend on the "32 bit-ness as a signed integer" accident of CPython's id() implementation on 32-bit machines. For example, code using struct.pack(), or code using one of ZODB's specialized int-key BTree types with id's as keys.
James
- Previous message: [Python-Dev] builtin_id() returns negative numbers
- Next message: [Python-Dev] builtin_id() returns negative numbers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]