Iterating through two lists
Charl P. Botha
cpbotha at i_triple_e.org
Fri May 24 07:34:21 EDT 2002
In article <3cee0ae6_1 at news3.newsgroups.com>, jb wrote:
> I have two lists, x and y with the property len(x) = len(y).
>
> I should like to achive this (x is a list of class instances)
>
> for (a,b) in (x,y): a.f(b)
>
> Is there a fancy way of doing this or have I to introduce an auxillary
> counter (that is very easy but maybe not very "lispy", that is
> "python-like").
map(lambda a, b: a.f(b), x, y)
Would also be a good way of doing it...
--
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/
More information about the Python-list
mailing list