[Python-ideas] Negative hexes

Nick Coghlan ncoghlan at gmail.com
Tue Dec 6 01:52:14 CET 2011

On Tue, Dec 6, 2011 at 10:16 AM, Guido van Rossum <guido at python.org> wrote:
>> Hmm, in the sense that the answer we're getting is the same answer you
>> would get with a cast to an unsigned type at the C level? I think
>> that's a little misleading - conceptually, the number is still signed,
>> we're just representing it differently (i.e. explicitly using the twos
>> complement form, rather than the the normal sign bit).
> I don't think there's a better term available. As long as the return value
> of to_unsigned() is never negative I think it's a fine name.

Recorded the RFE here (using "to_signed()/to_unsigned()"):

I was sold on the name when I read my own docstring: "Convert this
integer to its unsigned two's complement equivalent
for the given bit length"


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list