iters on ints? (reducing the need for range/xrange)
Paul Rubin
phr-n2001d at nightsong.com
Fri Nov 9 18:27:26 EST 2001
"Tim Peters" <tim.one at home.com> writes:
> > for i in 10:
> > doSomething(i)
> >...
> This isn't even half as disgusting as most people will say it is <wink>. I
> rather like it! Write a PEP.
The trouble is as someone else noted, "for i in 10" replaces "for i in
range(10)". But how do you handle range(1,10)? "for i in 1,10" does
precisely the wrong thing.
How about a way to use slices as iterators, with a little syntax so
you can say "for i in 1...10"? 1...10 would get parsed as a slice
object, that might or might not actually contain the Ellipsis.
More information about the Python-list
mailing list