On Tue, Dec 6, 2011 at 10:16 AM, Guido van Rossum <guido@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()"): http://bugs.python.org/issue13535 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" Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia