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/137020.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 17:08:38 CET 2014
On Sat, Nov 22, 2014 at 2:58 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> Since zip() is documented as
> halting on the shorter argument, it can't raise an exception. So what
> other options are there apart from silently consuming the value?

Sure, it's documented as doing that. But imagine something that isn't
a well-known function - all you have is someone writing a generator
that calls next() in multiple places. Is it obvious that it it'll
silently terminate as soon as any one of those iterators is exhausted?
In many cases, an exception (probably ValueError?) would be the most
obvious response.

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