int vs long
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Mon Jun 4 04:22:44 EDT 2007
In <f40fki$p9p$00$1 at news.t-online.com>, Peter Otten wrote:
> Marc 'BlackJack' Rintsch wrote:
>
>>>>> from itertools import count
>>>>> from sys import maxint
>>>>> c = count(maxint)
>>>>> c.next()
>> 2147483647
>>>>> c.next()
>> -2147483648
>>
>> What I find most disturbing here, is that it happens silently. I would
>> have expected an exception instead of the surprise.
>
> This is fixed in Python2.5:
>
>>>> from itertools import count
>>>> import sys
>>>> c = count(sys.maxint)
>>>> c.next(), c.next()
> (2147483647, 2147483648L)
Hm, my test above was from 2.5!?
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list