Long overflow problem

Fernando Pérez fperez528 at yahoo.com
Wed Nov 6 18:29:43 EST 2002


Tom wrote:


> def myFunc (i, j):
>    for a in range(i, j):
>       print a
> 
> I get the same error. Are there any implicit conversions going on here?

Yes, the problem is that range() doesn't accept longs. You can consider it a 
bug, but it's a feature :)

The quick fix is to do 'for a in range(j-i)' instead, and operate with 'i+a' 
instead. 

Cheers,

f



More information about the Python-list mailing list