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-December/075656.html below:

[Python-Dev] PEP Idea: Syntactic sugar for StopIteration.

[Python-Dev] PEP Idea: Syntactic sugar for StopIteration. [Python-Dev] PEP Idea: Syntactic sugar for StopIteration.Greg Ewing greg.ewing at canterbury.ac.nz
Sun Dec 9 01:09:15 CET 2007
Manuel Alejandro CerĂ³n Estrada wrote:

 > Acording to PEP 255:
 >
>     Note that return isn't always equivalent to raising StopIteration:  the
>     difference lies in how enclosing try/except constructs are treated.

All that means is that

   def g():
     try:
       if 0:
         yield
       return
     except StopIteration:
       print "Spam"

won't print "Spam". But since this involves catching the
exception with an explicit try-except, it doesn't fall
under the scope of your complaint.

> Of curse, the problem of low level details it's solved by 'yield break'

I would put it the other way around -- the problem
that 'yield break' is meant to solve is already solved
by 'return'. So there's no need for change.

--
Greg
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