[Python-Dev] signed - unsigned - big troubles 2.4a2

"Martin v. Löwis" martin at v.loewis.de
Fri Aug 6 11:37:26 CEST 2004


Grzegorz Makarewicz wrote:
> Many python programmas are relaying on computer int size - in prior 
> versions bitnees is 32 long - now smoething happens and signed/unsigned 
> value is not 32 bit long int but unsigned long int or even better 
> unsigned uint64
> 
> consider that:
>     a = ord(data[i]) .. data[i+4] - value is int or int64, signed or 
> unsigned ?
> 
> 0xf.. in prior versions up to 2.4.a2 int was used as signed value, now 
> it is unsigned int64, so my question how to create signed int32 ?

No, it is not unsigned int64:

Python 2.4a2 (#86, Aug  6 2004, 09:08:27)
[GCC 3.3.4 (Debian 1:3.3.4-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
28269553036454149273332760011886696253239742350009903329945699220681916415L
 >>>

This number does not fit in 64 bits. Instead, Python integers are 
without bounds. See

http://www.python.org/peps/pep-0237.html

Regards,
Martin


More information about the Python-Dev mailing list