A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-July/073803.html below:

[Python-Dev] itertools addition: getitem()

[Python-Dev] itertools addition: getitem() [Python-Dev] itertools addition: getitem()Raymond Hettinger python at rcn.com
Mon Jul 9 18:43:50 CEST 2007
From: "Guido van Rossum" <guido at python.org>
> But doesn't the very same argument also apply against islice(), which
> you just offered as an alternative?

Not really.  The use cases for islice() typically do not involve
repeated slices of an iterator unless it is slicing off the front
few elements on each pass.  In contrast, getitem() is all about
grabbing something other than the frontmost element and seems
to be intended for repeated calls on the same iterator.  And its
support for negative indices seems somewhat weird in the
context of general purpose iterators:  getitem(genprimes(), -1).

I'll study Walter's use case but my instincts say that adding
getitem() will do more harm than good.


Raymond
More information about the Python-Dev mailing list

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