A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-November/050032.html below:

[Python-Dev] print "%X" % id(object()) not so nice

[Python-Dev] print "%X" % id(object()) not so nice [Python-Dev] print "%X" % id(object()) not so niceJames Y Knight foom at fuhm.net
Fri Nov 19 21:48:19 CET 2004
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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4