[Python-Dev] Allowing slicing of iterators
Raymond Hettinger
python at rcn.com
Tue Jan 25 22:05:37 CET 2005
> Iterators are for single sequential access. It's a feature that you
> have to import itertools (or at least that you have to invoke its
> special operations) -- iterators are not sequences and shouldn't be
> confused with such.
FWIW, someone (Bengt Richter perhaps) once suggested syntactic support
differentiated from sequences but less awkward than a call to
itertools.islice().
itertools.islice(someseq, lo, hi) would be rendered as someseq'[lo:hi].
Raymond
More information about the Python-Dev
mailing list