Nick Coghlan <ncoghlan at iinet.net.au> 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4