Nick Coghlan <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > Since we already have the islice iterator, what's the point? > > 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.
If you want to use full sequence slicing semantics, then make yourself a list or tuple. I promise it will take less typing than itertools.islice() (at least in the trivial case of list(iterable)). Using language syntax to pretend that an arbitrary iterable is a list or tuple may well lead to unexpected behavior, whether that behavior is data loss or a caching of results. Which behavior is desireable is generally application specific, and I don't believe that Python should make that assumption for the user or developer. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com