Mark Dickinson <[EMAIL PROTECTED]> added the comment:

> What are the use cases for ranges with length greater than maxsize?

Yeah---I'm a bit short on use cases.  The one that originally bit me with 
Python 2.x was when I was doing a search for a quadratic non-residue 
modulo a largeish prime;

for i in range(1, p):
    if (i_is_a_nonresidue_modulo_p):
        break

Here p might be a 200-digit prime number, and the situation is that half 
the integers between 1 and p-1 are 'quadratic residues', while the other 
half are 'quadratic nonresidues';  in practice the residues and 
nonresidues are mixed up fairly well, so the first nonresidue shows up 
pretty quickly, but there's no known small upper bound on when the first 
nonresidue appears.

Of course, it's not hard to rewrite this with a while loop instead;  it 
would just be a bit annoying if that were necessary, when the code above 
is so clear and direct, and the one obvious way to do it (TM).

I'd also note that it's not completely out of the question that something 
like range(10**10) would be useful on a 32-bit machine:  a long-running 
process might easily go through 10**10 iterations of something.

I agree it's a bit strange to have a semi-functional range object, that 
you can iterate over but not take the length of.

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2690>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to