[Python-Dev] Allowing slicing of iterators (original) (raw)
Steven Bethard steven.bethard at gmail.com
Tue Jan 25 22:20:24 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 ]
Raymond Hettinger <python at rcn.com> wrote:
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].
Just to make sure I'm reading this right, the difference between sequence slicing and iterator slicing is a single-quote? IMVHO, that's pretty hard to read...
If we're really looking for a builtin, wouldn't it be better to go the route of getattr/setattr and have something like getslice that could operate on both lists and iterators? Then getslice(lst, lo, hi) would just be an alias for lst[lo:hi] and getslice(itr, lo, hi) would just be an alias for itertools.islice(itr, lo, hi)
Steve
You can wordify anything if you just verb it. --- Bucky Katt, Get Fuzzy
- Previous message: [Python-Dev] Allowing slicing of iterators
- Next message: [Python-Dev] Allowing slicing of iterators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]