[Python-checkins] CVS: python/nondist/peps pep-0202.txt,1.3,1.4
Guido van Rossum
python-dev@python.org
Thu, 27 Jul 2000 13:13:42 -0700
Update of /cvsroot/python/python/nondist/peps
In directory slayer.i.sourceforge.net:/tmp/cvs-serv17584
Modified Files:
pep-0202.txt
Log Message:
BDFL pronouncements.
Got rid of ^L.
Index: pep-0202.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0202.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** pep-0202.txt 2000/07/25 15:07:28 1.3
--- pep-0202.txt 2000/07/27 20:13:39 1.4
***************
*** 6,10 ****
Status: Incomplete
!
Introduction
--- 6,10 ----
Status: Incomplete
!
Introduction
***************
*** 12,17 ****
comprehensions.
-
The Proposed Solution
--- 12,17 ----
comprehensions.
+
The Proposed Solution
***************
*** 20,25 ****
statements nest now.
-
Rationale
--- 20,25 ----
statements nest now.
+
Rationale
***************
*** 28,32 ****
be used.
!
Examples
--- 28,32 ----
be used.
!
Examples
***************
*** 39,53 ****
>>> nums = [1,2,3,4]
>>> fruit = ["Apples", "Peaches", "Pears", "Bananas"]
! >>> print [i,f for i in nums for f in fruit]
[(1, 'Apples'), (1, 'Peaches'), (1, 'Pears'), (1, 'Bananas'),
(2, 'Apples'), (2, 'Peaches'), (2, 'Pears'), (2, 'Bananas'),
(3, 'Apples'), (3, 'Peaches'), (3, 'Pears'), (3, 'Bananas'),
(4, 'Apples'), (4, 'Peaches'), (4, 'Pears'), (4, 'Bananas')]
! >>> print [i,f for i in nums for f in fruit if f[0] == "P"]
[(1, 'Peaches'), (1, 'Pears'),
(2, 'Peaches'), (2, 'Pears'),
(3, 'Peaches'), (3, 'Pears'),
(4, 'Peaches'), (4, 'Pears')]
! >>> print [i,f for i in nums for f in fruit if f[0] == "P" if i%2 == 1]
[(1, 'Peaches'), (1, 'Pears'), (3, 'Peaches'), (3, 'Pears')]
>>> def zip(*args):
--- 39,53 ----
>>> nums = [1,2,3,4]
>>> fruit = ["Apples", "Peaches", "Pears", "Bananas"]
! >>> print [(i,f) for i in nums for f in fruit]
[(1, 'Apples'), (1, 'Peaches'), (1, 'Pears'), (1, 'Bananas'),
(2, 'Apples'), (2, 'Peaches'), (2, 'Pears'), (2, 'Bananas'),
(3, 'Apples'), (3, 'Peaches'), (3, 'Pears'), (3, 'Bananas'),
(4, 'Apples'), (4, 'Peaches'), (4, 'Pears'), (4, 'Bananas')]
! >>> print [(i,f) for i in nums for f in fruit if f[0] == "P"]
[(1, 'Peaches'), (1, 'Pears'),
(2, 'Peaches'), (2, 'Pears'),
(3, 'Peaches'), (3, 'Pears'),
(4, 'Peaches'), (4, 'Pears')]
! >>> print [(i,f) for i in nums for f in fruit if f[0] == "P" if i%2 == 1]
[(1, 'Peaches'), (1, 'Pears'), (3, 'Peaches'), (3, 'Pears')]
>>> def zip(*args):
***************
*** 56,61 ****
>>> print [i for i in zip(nums,fruit) if i[0]%2==0]
[(2, 'Peaches'), (4, 'Bananas')]
-
Reference Implementation
--- 56,61 ----
>>> print [i for i in zip(nums,fruit) if i[0]%2==0]
[(2, 'Peaches'), (4, 'Bananas')]
+
Reference Implementation
***************
*** 66,71 ****
for a patch that adds list comprehensions to Python.
!
Open Issues
--- 66,84 ----
for a patch that adds list comprehensions to Python.
+
+ BDFL Pronouncements
! Note: the BDFL refers to Guido van Rossum, Python's Benevolent
! Dictator For Life.
!
! - The syntax proposed above is the Right One.
!
! - The form [x, y for ...] should be disallowed; one should be
! required to write [(x, y) for ...].
!
! - The form [... for x... for y...] nests, with the last index
! varying fastest, just like nested for loops.
!
!
Open Issues
***************
*** 113,118 ****
is. It has not had a lot of exercise, though the patch does include
a few test cases.
-
Local Variables:
mode: indented-text
--- 126,131 ----
is. It has not had a lot of exercise, though the patch does include
a few test cases.
+
Local Variables:
mode: indented-text