[Python-Dev] Deprecation warning on integer shifts and such
Greg Ewing
greg@cosc.canterbury.ac.nz
Thu, 15 Aug 2002 14:58:09 +1200 (NZST)
Guido:
> In Python 2.4, the recommended way will be to write 0xffffffff and not
> worry about the fact that it's a positive long;
Yes, it won't be so much of an issue then. But you can still get a
negative long from a positive one when bit twiddling by complementing,
meaning that you have to remember to mask the result before displaying
it as hex, or end up with a hex representation that displays the bit
pattern in a way that's hard to interpret.
That's the usage I had in mind when I mentioned the 1x notation --
for display, not for input.
But thinking about it now, it would be better to provide a new
function for hexifying that you could tell how many bits you're
interested in, and it would show you that many, unsigned. Maybe
also a new format operator for this as well.
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg@cosc.canterbury.ac.nz +--------------------------------------+