Python style.

Charles Boncelet boncelet at udel.edu
Thu May 11 04:16:50 CEST 2000


Richard Jones wrote:

> [Johann Hibschman]
> > What you really want is something like:
> >
> > for item1, item2 in transpose((list1, list2)):
> >
> > to go from a tuple of two lists to a list of many tuples.  That's what
> > that awful map None does.
>
>    And, because I haven't had a chance to write any Python for far too long,
> here's an implementation of transpose() :)
>
> (code deleted)
>
>    Note the slightly different syntax in the call to transpose(). Extending the
> transpose class to N lists and re-writing it in C is left as an exercise to the
> reader.

It's been done. Check out Marc Lemberg's mxTools.  His "tuples" function is this.

--
------
Charles Boncelet, University of Delaware,
On sabbatical at ADFA, Canberra Australia,
Home Page: http://www.ece.udel.edu/~boncelet/






More information about the Python-list mailing list