Long int to int

Remco Gerlich scarblac at pino.selwerd.nl
Tue Feb 12 07:59:48 EST 2002


Tim Howarth <tim at worthy.demon.co.uk> wrote in comp.lang.python:
> All I want is a=b ! but lose longness of b !

That's simply not possible with a=0xFFFFFFFFL, since 0xFFFFFFFF is too large
for an int, and if b=-1 then a!=b.

What you're looking for is an int that has the same bit pattern as the
unsigned int would have, and people gave several solutions for that,
although they're not very straightforward; so it goes.

Bit shifting is for C, not Python, imo.
-- 
Remco Gerlich



More information about the Python-list mailing list