[Python-checkins] peps: Fix error in examples pointed out by Nicco Kunzmann and mention Haskell

nick.coghlan python-checkins at python.org
Tue Aug 9 13:37:36 CEST 2011


http://hg.python.org/peps/rev/e05c32e3cd1e
changeset:   3919:e05c32e3cd1e
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Tue Aug 09 21:37:23 2011 +1000
summary:
  Fix error in examples pointed out by Nicco Kunzmann and mention Haskell influence

files:
  pep-3150.txt |  13 +++++++------
  1 files changed, 7 insertions(+), 6 deletions(-)


diff --git a/pep-3150.txt b/pep-3150.txt
--- a/pep-3150.txt
+++ b/pep-3150.txt
@@ -36,9 +36,10 @@
 argument hack").
 
 The specific proposal in this PEP has been informed by various explorations
-of this and related concepts over the years (e.g. [1], [2], [3], [6]). It avoids
-some pitfalls that have been encountered in the past, but has not yet itself
-been subject to the test of implementation.
+of this and related concepts over the years (e.g. [1], [2], [3], [6]), and is
+inspired to some degree by the ``where`` and ``let`` clauses in Haskell. It
+avoids some problems that have been identified in past proposals, but has not
+yet itself been subject to the test of implementation.
 
 
 PEP Deferral
@@ -363,7 +364,7 @@
     def f():
       return i
     seq.append(f)
-  assert seq == [9]*10
+  assert [f() for f in seq] == [9]*10
 
   # Current Python (early binding via default argument hack)
   seq = []
@@ -371,7 +372,7 @@
     def f(_i=i):
       return i
     seq.append(f)
-  assert seq == list(range(10))
+  assert [f() for f in seq] == list(range(10))
 
   # Early binding via given clause
   seq = []
@@ -379,7 +380,7 @@
     seq.append(f) given:
       def f():
         return i
-  assert seq == list(range(10))
+  assert [f() for f in seq] == list(range(10))
 
 Note that the current intention is for the copy-in/copy-out semantics to
 apply only to names defined in the local scope containing the ``given``

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


More information about the Python-checkins mailing list