[Python-checkins] CVS: python/nondist/peps pep-0201.txt,1.3,1.4
Barry Warsaw
python-dev@python.org
Mon, 24 Jul 2000 10:40:03 -0700
Update of /cvsroot/python/python/nondist/peps
In directory slayer.i.sourceforge.net:/tmp/cvs-serv28717
Modified Files:
pep-0201.txt
Log Message:
Added a few more open issues:
- what should "zip()" do (i.e. zip with no arguments).
- should zip() be included in the builtins?
- the padtuple proposal
Index: pep-0201.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0201.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** pep-0201.txt 2000/07/19 04:19:54 1.3
--- pep-0201.txt 2000/07/24 17:40:00 1.4
***************
*** 126,130 ****
nor will zip() ever raise an exception with lists of different
lengths. To accomplish either behavior, the sequences must be
! checked and processed before the call to zip().
--- 126,131 ----
nor will zip() ever raise an exception with lists of different
lengths. To accomplish either behavior, the sequences must be
! checked and processed before the call to zip() -- but see the Open
! Issues below for more discussion.
***************
*** 391,394 ****
--- 392,403 ----
Current scoring seems to generally favor outcome 1.
+ - What should "zip()" do?
+
+ Along similar lines, zip() with no arguments (or zip() with just
+ a pad argument) can have ambiguous semantics. Should this
+ return no elements or an infinite number? For these reaons,
+ raising a TypeError exception in this case makes the most
+ sense.
+
- The name of the built-in `zip' may cause some initial confusion
with the zip compression algorithm. Other suggestions include
***************
*** 399,402 ****
--- 408,429 ----
with `zip' because the same functionality is available in other
languages (e.g. Haskell) under the name `zip'[2].
+
+ - Should zip() be including in the builtins module or should it be
+ in a separate generators module (possibly with other candidate
+ functions like irange())?
+
+ - Padding short sequences with different values. A suggestion has
+ been made to allow a `padtuple' (probably better called `pads'
+ or `padseq') argument similar to `pad'. This sequence must have
+ a length equal to the number of sequences given. It is a
+ sequence of the individual pad values to use for each sequence,
+ should it be shorter than the maximum length.
+
+ One problem is what to do if `padtuple' itself isn't of the
+ right length? A TypeError seems to be the only choice here.
+
+ How does `pad' and `padtuple' interact? Perhaps if padtuple
+ were too short, it could use pad as a fallback. padtuple would
+ always override pad if both were given.