iters on ints? (reducing the need for range/xrange)

James_Althoff at i2.com James_Althoff at i2.com
Fri Nov 9 13:40:38 EST 2001


Steven D. Majewski wrote:
>I wouldn't be against 'iter(10)' returning an iterator but having 10 BE
>an iterator is too much of a surprise.

Actually, that ("iter(10) returns an iterator") *is* the proposal (well, at
least that's what I *thought* was the suggestion :-): i.e., iter(10) would
return an iterator that iterates across the integers 0,1,2,3,4,5,6,7,8,9
(consistent with the standard sequence-indexing convention).  10 would not
*be* an iterator itself, but would return one in the context of a for-loop
just like lists and tuples do.

Jim






More information about the Python-list mailing list