Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-19 Thread Martin v. Löwis
Donovan Baarda wrote: Seriously, on the Python lists there has been a discussion rejecting an md5sum implementation because the author donated it to the public domain. Apparently lawyers have decided that you can't give code away. Intellectual charity is illegal :-) Despite the smiley: It is not

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-18 Thread Donovan Baarda
From: Armin Rigo [EMAIL PROTECTED] Hi Tim, On Thu, Feb 17, 2005 at 01:44:11PM -0500, Tim Peters wrote: 256 ** struct.calcsize('P') Now if you'll just sign and fax a Zope contributor agreement, I'll upgrade ZODB to use this slick trick wink. I hereby donate this line of code to

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-17 Thread Armin Rigo
Hi Tim, On Mon, Feb 14, 2005 at 10:41:35AM -0500, Tim Peters wrote: # 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). Isn't this natural width nowadays available as:

[Python-Dev] builtin_id() returns negative numbers

2005-02-16 Thread Richard Brodie
Maybe it's just a wart we have to live with now; OTOH, the docs explicitly warn that id() may return a long, so any code relying on short int-ness has always been relying on an implementation quirk. Well, the docs say that %x does unsigned conversion, so they've been relying on an

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-16 Thread Greg Ewing
Richard Brodie wrote: Otherwise, unless I misunderstand integer unification, one would just have to strike the distinction between, say, %d and %u. Couldn't that be done anyway? The distinction really only makes sense in C, where there's no way of knowing whether the value is signed or unsigned

[Python-Dev] builtin_id() returns negative numbers

2005-02-14 Thread Troels Walsted Hansen
Hi all, The Python binding in libxml2 uses the following code for __repr__(): class xmlNode(xmlCore): def __init__(self, _obj=None): self._o = None xmlCore.__init__(self, _obj=_obj) def __repr__(self): return xmlNode (%s) object at 0x%x % (self.name, id (self)) With

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-14 Thread Tim Peters
[Troels Walsted Hansen] The Python binding in libxml2 uses the following code for __repr__(): class xmlNode(xmlCore): def __init__(self, _obj=None): self._o = None xmlCore.__init__(self, _obj=_obj) def __repr__(self): return xmlNode (%s) object at 0x%x %

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-14 Thread James Y Knight
On Feb 14, 2005, at 10:41 AM, Tim Peters wrote: Wouldn't it be more elegant to make builtin_id() return an unsigned long integer? I think so. This is the function ZODB 3.3 uses, BTW: def positive_id(obj): Return id(obj) as a non-negative integer. [...] I think it'd be nice to change it, too.