[Python-Dev] PEP 201 - Parallel iteration
Gordon McMillan
gmcm@hypernet.com
Mon, 17 Jul 2000 16:22:45 -0400
Barry A. Warsaw wrote:
[PEP 201, Parallel Iteration]
> Open Issues
>
> - What should "zip(a)" do? Given
>
> a = (1, 2, 3); zip(a)
>
> three outcomes are possible.
How about a fourth: zip(a) is the same as zip(a, []) ?
Look at it this way: what should zip(a, pad=None) return?
Obviously: [(1, None), (2, None), (3, None)]
So what should zip(a) return? Don't special case it, just return
[].
With only one arg, zip has clearly lost meaning. That is, it's
clearly a degenerate case, and not worth a bunch of special
casing.
although-we-do-special-case-Barry-ly y'rs
- Gordon