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

Terry Reedy tjreedy at udel.edu
Sat Nov 20 04:03:15 CET 2004


"Bob Ippolito" <bob at redivi.com> wrote in message 
news:D3128502-3A8E-11D9-925A-000A9567635C at redivi.com...
> The problem, more than anything else, is the following behavior that can 
> happen during a random __repr__ or repr-like-function if the object 
> happens to have a certain address range:
>
> - (Python 2.3) You get an unexpected and unwanted warning but expected 
> output anyway
> - (Python 2.4) You get a repr with a strange looking negative hex number 
> (0x-FF0102)
>
> Neither of these are fatal, of course, it's just annoying.. I find the 
> Python 2.3 behavior more obnoxious than Python 2.4's, personally.

Non-CS users probably find *all* hex numbers a little strange looking.  If 
CPython were to simply print ids as decimal integers, instead of being 
fancy with hex 'addresses' there would have been no warnings and no change 
;-).  Is the absolute hex value ever of any use?  If so, how often?

Terry J. Reedy






More information about the Python-Dev mailing list