[Python-checkins] peps: Parallel => Lockstep everywhere.

georg.brandl python-checkins at python.org
Wed Mar 23 21:23:50 CET 2011


http://hg.python.org/peps/rev/3c9e17945a3c
changeset:   60:3c9e17945a3c
user:        Barry Warsaw <barry at python.org>
date:        Fri Jul 28 05:48:25 2000 +0000
summary:
  Parallel => Lockstep everywhere.

Replaced the reference implementation with one that's closer to what
the C code will actually look like; i.e. it obeys the iteration
protocol.

Other grammar and spelling fixes.

files:
  pep-0201.txt |  52 ++++++++++++++++++++-------------------
  1 files changed, 27 insertions(+), 25 deletions(-)


diff --git a/pep-0201.txt b/pep-0201.txt
--- a/pep-0201.txt
+++ b/pep-0201.txt
@@ -1,5 +1,5 @@
 PEP: 201
-Title: Parallel Iteration
+Title: Lockstep Iteration
 Version: $Revision$
 Author: bwarsaw at beopen.com (Barry A. Warsaw)
 Python-Version: 2.0
@@ -10,14 +10,14 @@
 
 Introduction
 
-    This PEP describes the `parallel iteration' proposal for Python
-    2.0, previously known as `parallel for loops'.  This PEP tracks
-    the status and ownership of this feature, slated for introduction
-    in Python 2.0.  It contains a description of the feature and
-    outlines changes necessary to support the feature.  This PEP
-    summarizes discussions held in mailing list forums, and provides
-    URLs for further information, where appropriate.  The CVS revision
-    history of this file contains the definitive historical record.
+    This PEP describes the `lockstep iteration' proposal for Python
+    2.0.  This PEP tracks the status and ownership of this feature,
+    slated for introduction in Python 2.0.  It contains a description
+    of the feature and outlines changes necessary to support the
+    feature.  This PEP summarizes discussions held in mailing list
+    forums, and provides URLs for further information, where
+    appropriate.  The CVS revision history of this file contains the
+    definitive historical record.
 
 
 Motivation
@@ -33,9 +33,9 @@
     iterations by introducing a new builtin function called `zip'.
 
 
-Parallel For-Loops
+Lockstep For-Loops
 
-    Parallel for-loops are non-nested iterations over two or more
+    Lockstep for-loops are non-nested iterations over two or more
     sequences, such that at each pass through the loop, one element
     from each sequence is taken to compose the target.  This behavior
     can already be accomplished in Python through the use of the map()
@@ -70,10 +70,10 @@
       [(1, 4), (2, 5), (3, 6), (None, 7)]
 
     For these reasons, several proposals were floated in the Python
-    2.0 beta time frame for providing a better spelling of parallel
+    2.0 beta time frame for providing a better spelling of lockstep
     for-loops.  The initial proposals centered around syntactic
     changes to the for statement, but conflicts and problems with the
-    syntax were unresolvable, especially when parallel for-loops were
+    syntax were unresolvable, especially when lockstep for-loops were
     combined with another proposed feature called `list
     comprehensions' (see pep-0202.txt).
 
@@ -140,21 +140,23 @@
 Reference Implementation
 
     Here is a reference implementation, in Python of the zip()
-    built-in function.  These would ultimately be replaced by
-    equivalent C code.
+    built-in function.  This will be replaced with a C implementation
+    after final approval.
 
     def zip(*args):
         if not args:
             raise TypeError('zip() expects one or more sequence arguments')
         ret = []
-        # find the length of the shortest sequence
-        shortest = min(*map(len, args))
-        for i in range(shortest):
-            item = []
-            for s in args:
-                item.append(s[i])
-            ret.append(tuple(item))
-        return ret
+        i = 0
+        try:
+            while 1:
+                item = []
+                for s in args:
+                    item.append(s[i])
+                ret.append(tuple(item))
+                i = i + 1
+        except IndexError:
+            return ret
 
 
 BDFL Pronouncements
@@ -165,8 +167,8 @@
     - The function's name.  An earlier version of this PEP included an
       open issue listing 20+ proposed alternative names to zip().  In
       the face of no overwhelmingly better choice, the BDFL strongly
-      prefers zip() due to it's Haskell[2] heritage.  See version 1.7
-      of this PEP for the list of alteratives.
+      prefers zip() due to its Haskell[2] heritage.  See version 1.7
+      of this PEP for the list of alternatives.
 
     - zip() shall be a built-in function.
 

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


More information about the Python-checkins mailing list