islice ==> [::]

castironpi at gmail.com castironpi at gmail.com
Fri Mar 7 20:22:49 CET 2008


> > I find itertools.islice() useful, so for Python 3.x I may like to see
> general iterables.  Third, the analogy breaks down quickly (i.e.
> chain(it[:2], it[2:]) does not give the same result as iter(it) unless

> >>> s = 'abcdefg'
> >>> list(W(s)[2:])

Slice literals are a logical next step, precedented by raw strings and
bytes.  slice= islice is too, precedented by range= xrange.

Does s[2:] evaluate to an infinity?  What is the natural meaning of
skipping finitely many terms at the head of an iterable?  itertools
can also grow 'skip(n=0)' and 'drop(step=3)' operations.



More information about the Python-list mailing list