Long overflow problem
Tom
bondpaper at earthlink.net
Wed Nov 6 21:02:18 EST 2002
In article <aqc8l7$a55$1 at peabody.colorado.edu>,
Fernando Perez <fperez528 at yahoo.com> wrote:
> 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
Ok...it's a range issue. And in addition to your suggestion, I just
realized....a simple "while i < j..." would have sufficed. Amazing how
the simplest answers take the longest to figure out sometimes. : )
Regards,
Tom
More information about the Python-list
mailing list