[Python-Dev] Deprecation warning on integer shifts and such
Greg Ewing
greg@cosc.canterbury.ac.nz
Thu, 15 Aug 2002 11:06:52 +1200 (NZST)
Oren Tirosh <oren-py-d@hishome.net>:
> In Python up to 2.2 it's inconsistent between ints and longs:
> >>> hex(-16711681)
> '0xff00ffff'
> >>> hex(-16711681L)
> '-0xff0001L' # ??!?!?
The more I think about it, the more I like the suggestion
that was made of representing this as
1x00ffff
which both makes the bit pattern apparent and unambiguously
indicates the sign, all without any assumptions about length.
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 +--------------------------------------+