[Python-Dev] PEP 201 - Parallel iteration

Gordon McMillan gmcm@hypernet.com
Tue, 18 Jul 2000 08:26:02 -0400


Moshe Zadka wrote:

> (assume a = [1, 2, 3])
> 
> On Mon, 17 Jul 2000, Gordon McMillan wrote:
> 
> > How about a fourth: zip(a) is the same as zip(a, []) ?
> 
> Huh???????????????????
> 
> > Look at it this way: what should zip(a, pad=None) return?
> 
> [(1,), (2,), (3,)], of course

Then why does the PEP say:
   >>> zip(a, b, c, d, pad=None)
    [(1, 5, 9, 12), (2, 6, 10, 13), (3, 7, 11, None), (4, 8, None, None)]
    >>> map(None, a, b, c, d)
    [(1, 5, 9, 12), (2, 6, 10, 13), (3, 7, 11, None), (4, 8, None, None)]

If you want no padding, you don't specify a pad arg. pad=None 
means "pad with None".

> > Obviously: [(1, None), (2, None), (3, None)]
> 
> Why?

To be consistent.

- Gordon