[Python-Dev] Re: Allowing slicing of iterators

Fredrik Lundh fredrik at pythonware.com
Wed Jan 26 18:44:32 CET 2005


Guido van Rossum wrote:
>> I'd like to see iterators become as easy to work with as lists are. At the
>> moment, anything that returns an iterator forces you to use the relatively
>> cumbersome itertools.islice mechanism, rather than Python's native slice syntax.
>
> Sorry. Still -1.

can we perhaps persuade you into changing that to a -0.1, so we can
continue playing with the idea?

> iterators are not sequences and shouldn't be confused with such.

the for-in statement disagrees with you, I think.  on the other hand, I'm not
sure I trust that statement any more; I'm really disappointed that it won't let
me write my loops as:

    for item in item for item in item for item in item for item in seq:
        ...

</F> 





More information about the Python-Dev mailing list