islice ==> [::]

bearophileHUGS at bearophileHUGS at
Fri Mar 7 13:49:19 CET 2008

I find itertools.islice() useful, so for Python 3.x I may like to see
it removed from the itertools module, and the normal slicing syntax
[::] extended to work with generators/iterators too.

from itertools import islice
primes = (x for x in xrange(1,999) if all(x % y for y in xrange(2,
print list(islice(primes, 0, 20))
print list(primes[:20])


More information about the Python-list mailing list