itertools comments [Was: Re: RELEASED: Python 2.3a2]

Alexander Schmolck a.schmolck at gmx.net
Fri Feb 21 18:49:17 EST 2003


Alex Martelli <aleax at aleax.it> writes:

> Alexander Schmolck wrote:
> 
> > Alex Martelli <aleax at aleax.it> writes:
> >> Not without breaking, e.g., xrange(23, 17923, 12)[15] -- which now
> >> has a perfectly good result of 203 and would break if xrange
> >> returned an iterator (or any other non-indexable object).
> > 
> > It could always return and indexable iterator.
> 
> It would only seem to break such usage as:
> 
> N_times = xrange(N)
> 
> for i in N_times:
>     for j in N_times:
>         process(i, j)
> 

Excellent point. So it is not an option.

alex




More information about the Python-list mailing list