Inconsistency in hex()
Steven D'Aprano
steve at REMOVETHIScyber.com.au
Thu Jul 14 08:37:31 EDT 2005
On Wed, 13 Jul 2005 20:57:54 -0700, Paul Rubin wrote:
> Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
>> >>> hex(75)
>> '0x4b'
>> >>> hex(75*256**4)
>> '0x4B00000000L'
>>
>> By accident or design? Apart from the aesthetic value that lowercase hex
>> digits are ugly, should we care?
>
> Use ('%x' % 75) or ('%X' % 75) if you care.
Ah! Now that's the sort of utterly obvious in hindsight thing that
wouldn't have occurred to me in a month of Sundays. That's why c.l.p is so
useful -- lots of people with lots of ways of doing things, all sharing.
Thanks Paul.
(Actually, I don't care at the moment, but when I do, I'll have a fix.)
--
Steven.
More information about the Python-list
mailing list