A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-July/006929.html below:

[Python-Dev] PEP 201 - Parallel iteration

[Python-Dev] PEP 201 - Parallel iterationGordon McMillan gmcm@hypernet.com
Tue, 18 Jul 2000 15:11:37 -0400
Moshe wrote:

> I disagree: you agree that if you add a pad argument when the
> lists are all the same size it doesn't matter (if you don't agree
> with this, you don't agree with the PEP). Now, when there is only
> one list, the lists are all the same size. QED.

I would agree if we were talking about transpose(matrix, 
[pad]). Then:
  transpose([(1,2,3)]) -> [(1,), (2,), (3,)] and
  transpose([(1,), (2,), (3,)]) -> [(1,2,3)]
That is, a 3X1 transposes to a 1X3 and vice versa.

But zip doesn't take a matrix, it takes some number of 
sequences.

Oh heck, I'll agree anyway. But I dread explaining why
 1) it doesn't behave like map(None, [1,2,3])
 2) why zip(((1,2),(3,4))) doesn't yield [(1,3), (2,4)] but [((1,2),), 
((3,4),)] instead!

So: document zip as taking 2 or more sequences, and throw 
an exception if fed only one. 


- Gordon



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4