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

Paul Rubin phr-n2001d at nightsong.com
Fri Nov 9 08:16:01 EST 2001


Carsten Gaebler <clpy at snakefarm.org> writes:

> Paul Rubin wrote:
> 
> > Really the ellipsis should make an iterator: for i in 0...10.
> 
> Sounds pretty cool. However, the ellipsis seems to be poorly
> documented.

I guess the parser would have to change for the above to work.
Right now you'd have to say for i in 0:...:10
and I'm not sure if that's syntactically valid.

As far as I can tell, the only current use of ellipsis is in
dictionary indexing.  One can imagine mapping a database into a
dictionary, so db[4:...:19] does a select on those elements.



More information about the Python-list mailing list