Looks like I'm not the only one who has noticed this :)

Begin forwarded message:

From: James Y Knight <[EMAIL PROTECTED]>
Date: November 19, 2004 10:48:19 PM EET
To: Python Dev <[EMAIL PROTECTED]>
Subject: [Python-Dev] print "%X" % id(object()) not so nice

I think id() should never be returning a negative number. Both these behaviors are poor:

In 2.3:
>>> print "%X" % id(o)
__main__:1: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up
A5F48198


In 2.4:
>>> print "%X" %id(o)
-5FC84D08

Pointers are conventionally never treated or printed as signed. In 2.3 and before, it usually ended up okay, besides the warning, because "%X" had broken behavior. In 2.4, now it's ending up doing the wrong thing and printing a confusing value. I propose that id() always return a positive value. This means that it will sometimes have to return a long instead of an int, but, it already does that under some circumstances on some architectures.

Comments?

James

_______________________________________________
Python-Dev mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/bob%40redivi.com
_______________________________________________
[EMAIL PROTECTED]
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to