Iterating through two lists
Denis S. Otkidach
ods at fep.ru
Fri May 24 06:04:47 EDT 2002
On Fri, 24 May 2002, jb wrote:
j> I have two lists, x and y with the property len(x) = len(y).
j>
j> I should like to achive this (x is a list of class instances)
j>
j> for (a,b) in (x,y): a.f(b)
j>
j> Is there a fancy way of doing this or have I to introduce an
j> auxillary
j> counter (that is very easy but maybe not very "lispy", that
j> is
j> "python-like").
If lists are not very lange try this:
for a, b in zip(x, y): a.f(b)
More information about the Python-list
mailing list