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
This commit is contained in:
Barry Warsaw 2000-07-24 17:40:00 +00:00
parent 041efa077b
commit 3bc6d31633
1 changed files with 28 additions and 1 deletions

View File

@ -125,7 +125,8 @@ The Proposed Solution
It is not possible to pad short lists with different pad values, It is not possible to pad short lists with different pad values,
nor will zip() ever raise an exception with lists of different nor will zip() ever raise an exception with lists of different
lengths. To accomplish either behavior, the sequences must be lengths. To accomplish either behavior, the sequences must be
checked and processed before the call to zip(). checked and processed before the call to zip() -- but see the Open
Issues below for more discussion.
@ -390,6 +391,14 @@ Open Issues
Current scoring seems to generally favor outcome 1. 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 - The name of the built-in `zip' may cause some initial confusion
with the zip compression algorithm. Other suggestions include with the zip compression algorithm. Other suggestions include
(but are not limited to!): marry, weave, parallel, lace, braid, (but are not limited to!): marry, weave, parallel, lace, braid,
@ -399,6 +408,24 @@ Open Issues
with `zip' because the same functionality is available in other with `zip' because the same functionality is available in other
languages (e.g. Haskell) under the name `zip'[2]. 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.
References References