Dot-comma, anyone? (Re: zip or marry etc)

Greg Ewing see at my.signature
Thu Jul 20 00:49:47 EDT 2000


Paul Prescod wrote:
> 
> We're looking just to pair up elements.

In that case, obviously the solution is to combine this
thread with the one on new operator symbols, and define
an elementwise tuple-creation operator

   .,

as in

  [1,2,3] ., [4,5,6] == [(1,4), (2,5), (3,6)]

It might even look halfway decent in a for loop:

  for x,y in a.,b:
    ...

It would be a somewhat strange operator, as it would have
to extend over multiple arguments like comma does, so that

  for x,y,z in a.,b.,c:
   ....

would do the right thing. So it wouldn't really be an operator,
more of a new built-in syntax for zipping, in the same way
that the comma is a built-in syntax for tuple construction.

Do-you-think-"Will-you-zip-me?"-is-likely-to-catch-on-as-
a-proposal-line-between-Pythoneer-lovers-ly,

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list