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/2009-January/085262.html below:

Add a "while" clause to generator expressions

[Python-Dev] PEP 3142: Add a "while" clause to generator expressions [Python-Dev] PEP 3142: Add a "while" clause to generator expressionsTerry Reedy tjreedy at udel.edu
Wed Jan 21 00:27:58 CET 2009
Gerald Britton wrote:
> I wonder if this is a bug?

It is a known glitch reported last summer.  Devs decided not to fix 
because doing so would, in the patches tried, slow list comps 
significantly.  Also, the documented intent and expected usage of 
StopIteration is this

"exception StopIteration
Raised by builtin next() and an iterator‘s __next__() method to signal 
that there are no further values."

The second clause includes usage in the body of a generator function 
since that body becomes the __next__ method of the generator-iterator 
produced by calling the generator function.

The meaning of any other usage, such as in the body of a standard 
function other than next(),(as in the example producing the glitch), is 
undefined and leads to undefined behavior, which could be different in 
other implementations and change in future implementations.

Terry Jan Reedy

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