hex/oct constants > sys.maxint will return positive values in Python 2.4 and up

Bengt Richter bokr at oz.net
Thu Nov 7 15:12:21 EST 2002


On Thu, 07 Nov 2002 13:42:13 -0500, Tim Peters <tim.one at comcast.net> wrote:

>[Bengt Richter
>> How about
>>
>>     BIT31 = 1<<31
>>
>> and then use BIT31 wherever?
>
>That's currently platform-dependent in exactly the same way as 0x80000000,
>will also become platform-independent in Python 2.4, and also generates a
>warning in 2.3:
>
>>>> 1 << 31
>__main__:1: FutureWarning: x<<y losing bits or changing sign will
>            return a long in Python 2.4 and up
>-2147483648
>>>>
Ok, sorry, does
     BIT31 = 1L<<31
work?

Regards,
Bengt Richter



More information about the Python-list mailing list