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/2014-November/137009.html below:

Change StopIteration handling inside generators

[Python-Dev] PEP 479: Change StopIteration handling inside generators [Python-Dev] PEP 479: Change StopIteration handling inside generatorsChris Angelico rosuav at gmail.com
Fri Nov 21 14:53:41 CET 2014
On Sat, Nov 22, 2014 at 12:47 AM, Raymond Hettinger
<raymond.hettinger at gmail.com> wrote:
> Also, the proposal breaks a reasonably useful pattern of calling
> next(subiterator) inside a generator and letting the generator terminate
> when the data stream  ends.  Here is an example that I have taught for
> years:
>
>     def izip(iterable1, iterable2):
>         it1 = iter(iterable1)
>         it2 = iter(iterable2)
>         while True:
>             v1 = next(it1)
>             v2 = next(it2)
>             yield v1, v2

Is it obvious to every user that this will consume an element from
it1, then silently terminate if it2 no longer has any content?

ChrisA
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