[Python-Dev] Allowing slicing of iterators (original) (raw)
Raymond Hettinger python at rcn.com
Tue Jan 25 22:05:37 CET 2005
- Previous message: [Python-Dev] Allowing slicing of iterators
- Next message: [Python-Dev] Allowing slicing of iterators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] Allowing slicing of iterators
- Next message: [Python-Dev] Allowing slicing of iterators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]