[Python-checkins] peps: Add a clarifying paragraph to PEP 0479, and another post-history date.

guido.van.rossum python-checkins at python.org
Thu Nov 20 19:56:12 CET 2014


https://hg.python.org/peps/rev/b218685f6a4d
changeset:   5603:b218685f6a4d
user:        Guido van Rossum <guido at python.org>
date:        Thu Nov 20 10:55:48 2014 -0800
summary:
  Add a clarifying paragraph to PEP 0479, and another post-history date.

files:
  pep-0479.txt |  16 +++++++++++++++-
  1 files changed, 15 insertions(+), 1 deletions(-)


diff --git a/pep-0479.txt b/pep-0479.txt
--- a/pep-0479.txt
+++ b/pep-0479.txt
@@ -8,7 +8,7 @@
 Content-Type: text/x-rst
 Created: 15-Nov-2014
 Python-Version: 3.5
-Post-History: 15-Nov-2014
+Post-History: 15-Nov-2014, 19-Nov-2014
 
 
 Abstract
@@ -179,6 +179,20 @@
 in favor of changing list comprehensions to match generator
 expressions (!), the other was in favor of this PEP's main proposal.
 
+The existing model has been compared to the perfectly-acceptable
+issues inherent to every other case where an exception has special
+meaning.  For instance, an unexpected ``KeyError`` inside a
+``__getitem__`` method will be interpreted as failure, rather than
+permitted to bubble up.  However, there is a difference. Dunder
+methods use ``return`` to indicate normality, and ``raise`` to signal
+abnormality; generators ``yield`` to indicate data, and ``return`` to
+signal the abnormal state.  This makes explicitly raising
+``StopIteration`` entirely redundant, and potentially surprising.  If
+other dunder methods had dedicated keywords to distinguish between
+their return paths, they too could turn unexpected exceptions into
+``RuntimeError``; the fact that they cannot should not preclude
+generators from doing so.
+
 
 References
 ==========

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list