My Python annoyances

Ross Ridge rridge at caffeine.csclub.uwaterloo.ca
Sat May 5 04:14:40 EDT 2007


Ben Collver  <collver at peak.org> wrote:
>It is problem report #1678102.  I understand the problem: that a 32 bit 
>number looks different in a 32 bit signed int than in a 64 bit signed 
>int.  However, the workaround of dropping a bit seems to defeat the 
>purpose of using a CRC.

The workaround doesn't drop any bits, it converts the value to a Python
long and extracts the lower 32 bits.

There's really no good reason for Python to give two different results
here.  It should either return a signed 32-bit CRC value in a Python int,
or return a unsigned 32-bit CRC value in either Python long or a Python
int, if it's big enough.  What it's doing now, returning unsigned value in
a Python int, even when it's not big enough to hold the result, is wrong.

					Ross Ridge

-- 
 l/  //	  Ross Ridge -- The Great HTMU
[oo][oo]  rridge at csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //	  



More information about the Python-list mailing list