Raymond Hettinger <[EMAIL PROTECTED]> 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
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com