[Python-Dev] zip() and list-comprehension with commas

Paul Prescod paul@prescod.net
Wed, 12 Jul 2000 11:01:37 -0500


Skip Montanaro wrote:
> 
>     BAW> Alternatives (as Greg I think brought up): pairwise(), maybe
>     BAW> zipper() for zip() since it's more evocative.
> 
> "zip" already has a lot of compression connotations.  How about "stitch", as
> in "stitch two lists together"?

"Stitch" and "with" are okay, but I'd like to hear someone debunk the
names used today by MAL. They seemed very logical to me. I'd just change
the semantics to be lazy in a couple of cases.

>>> tuple([1,2,3])
(1,2,3)

>>> tuples([1,2,3],[4,5,6])
<tuple generator: ((1,4),(2,5),(3,6)>

>>> list((1,2,3))
[1,2,3]

>>> lists((1,2,3),(4,5,6)) 
<list generator: [1,4],[2,5],[3,6]>

>>> dict([(1,2),(3,4),(5,6)])
{1:2,3:4,5:6}

-- 
 Paul Prescod - Not encumbered by corporate consensus
Simplicity does not precede complexity, but follows it. 
	- http://www.cs.yale.edu/~perlis-alan/quotes.html