[Python-checkins] CVS: python/nondist/peps pep-0201.txt,1.11,1.12

Barry Warsaw python-dev@python.org
Mon, 31 Jul 2000 08:52:48 -0700


Update of /cvsroot/python/python/nondist/peps
In directory slayer.i.sourceforge.net:/tmp/cvs-serv16561

Modified Files:
	pep-0201.txt 
Log Message:
Integrated many suggestions from c.l.py and others.  Nothing
substantial w.r.t. the proposed solution, just clarifications,
additional references, and an explanation of why most syntax changes
don't work.


Index: pep-0201.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0201.txt,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** pep-0201.txt	2000/07/28 05:48:25	1.11
--- pep-0201.txt	2000/07/31 15:52:45	1.12
***************
*** 11,22 ****
  Introduction
  
!     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.
  
  
--- 11,22 ----
  Introduction
  
!     This PEP describes the `lockstep iteration' proposal.  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.
  
  
***************
*** 26,37 ****
      sequence until the sequence is exhausted[1].  However, for-loops
      iterate over only a single sequence, and it is often desirable to
!     loop over more than one sequence, in a lock-step, "Chinese Menu"
!     type of way.
  
-     The common idioms used to accomplish this are unintuitive and
-     inflexible.  This PEP proposes a standard way of performing such
-     iterations by introducing a new builtin function called `zip'.
- 
- 
  Lockstep For-Loops
  
--- 26,41 ----
      sequence until the sequence is exhausted[1].  However, for-loops
      iterate over only a single sequence, and it is often desirable to
!     loop over more than one sequence in a lock-step fashion.  In other
!     words, in a way such that nthe i-th iteration through the loop
!     returns an object containing the i-th element from each sequence.
! 
!     The common idioms used to accomplish this are unintuitive.  This
!     PEP proposes a standard way of performing such iterations by
!     introducing a new builtin function called `zip'.
! 
!     While the primary motivation for zip() comes from lock-step
!     iteration, by implementing zip() as a built-in function, it has
!     additional utility in contexts other than for-loops.
  
  Lockstep For-Loops
  
***************
*** 71,81 ****
  
      For these reasons, several proposals were floated in the Python
!     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 lockstep for-loops were
!     combined with another proposed feature called `list
!     comprehensions' (see pep-0202.txt).
  
  
  The Proposed Solution
--- 75,92 ----
  
      For these reasons, several proposals were floated in the Python
!     2.0 beta time frame for syntactic support of lockstep for-loops.
!     Here are two suggestions:
! 
!     for x in seq1, y in seq2:
!         # stuff
! 
!     for x, y in seq1, seq2:
!         # stuff
  
+     Neither of these forms would work, since they both already mean
+     something in Python and changing the meanings would break existing
+     code.  All other suggestions for new syntax suffered the same
+     problem, or were in conflict with other another proposed feature
+     called `list comprehensions' (see pep-0202.txt).
  
  The Proposed Solution
***************
*** 207,211 ****
      [2] http://www.haskell.org/onlinereport/standard-prelude.html#$vzip
  
!     TBD: URL to python-dev archives
  
  
--- 218,223 ----
      [2] http://www.haskell.org/onlinereport/standard-prelude.html#$vzip
  
!     Greg Wilson's questionaire on proposed syntax to some CS grad students
!     http://www.python.org/pipermail/python-dev/2000-July/013139.html