How about adding slice notation to iterators/generators?

Bearophile bearophileHUGS at lycos.com
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.

Bye,
bearophile



More information about the Python-list mailing list