How about adding slice notation to iterators/generators?

Bearophile bearophileHUGS at
Fri Oct 16 11:02:26 CEST 2009

Terry Reedy:

> 1. islice works with any iterator; generator method would only work with
> generators

A slice syntax that's syntactic sugar for islice(some_iter,1,None) may
be added to all iterators.

>2. iterator protocol is intentionally simple.<

Slice syntax is already available for lists, tuples, strings, arrays,
numpy, etc, so adding it to iterators too doesn't look like adding
that large amount of information to the mind of the programmer.


More information about the Python-list mailing list