zip or marry etc
Michael Hudson
mwh21 at cam.ac.uk
Wed Jul 19 02:13:23 EDT 2000
Robin Becker <robin at jessikat.fsnet.co.uk> writes:
> I suppose there must be something desperately wrong with using the
> __mul__ for sequences to indicate the set pairwise product. I would
> certainly be for
>
> x,y in A*B rather than x,y in zip(A,B) or marry(A,B), but since * is the
> obvious operator it must be that someone else has reserved it.
Well, whatever "zip" ends up being called, it doesn't return the
Cartesian product of the set of elements of the list, so using the
product operator would be, at best, confusing!
Wouldn't you expect
>>> for i,j in [0,1]*[2,3]:
... print i,j
(0,2)
(0,3)
(1,2)
(1,3)
rather than
>>> for i,j in zip([0,1],[2,3]):
... print i,j
(0,2)
(1,3)
?
Cheers,
M.
--
I also fondly recall Paris because that's where I learned to
debug Zetalisp while drunk. -- Olin Shivers
More information about the Python-list
mailing list