[Python-Dev] test warnings for "%x"%id(foo) on 2.3 branch

Anthony Baxter anthony at interlink.com.au
Wed Nov 5 06:28:17 EST 2003

>>> Anthony Baxter wrote
> Hm. "%x" % (id(o) & 2L*sys.maxint+1)
> is considerably less obvious that "%x"%id(o)

The best I can come up with at this moment using the 'struct' module is
''.join(['%02x'%ord(x) for x in struct.pack('>i', id(o))]), which is also
pretty grotesque. 

Thinking about it further, the better fix might be to replace the test
code that looks for an exact match with a regex-based match instead...

Anthony Baxter     <anthony at interlink.com.au>   
It's never too late to have a happy childhood.

More information about the Python-Dev mailing list