On Mon, Oct 31, 2011 at 2:02 AM, Gnarlodious <gnarlodi...@gmail.com> wrote:
> Orders=[Order(x,y,z) for x,y,z in [ratio, bias, locus]]
>

Assuming that you intend to take the first element of each list, then
the second, and so on, you'll want to use zip():

Orders=[Order(x,y,z) for x,y,z in zip(ratio, bias, locus)]

With your syntax, Python iterates over a three-element list. The first
iteration, it looks at 'ratio' and tries to unpack that into x,y,z;
this doesn't work, because ratio has five elements. The second
iteration would try to unpack 'bias', and the third would go for
'locus'.

The zip function returns tuples of (ratio[N], bias[N], locus[N]) for
successive Ns:

>>> list(zip(ratio,bias,locus))
[(1, True, 'A'), (2, False, 'B'), (3, True, 'C'), (4, False, 'D'), (5,
True, 'E')]

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to