Re: Assign values from list to list of instances

2011-11-01 Thread Gnarlodious
On Nov 1, 3:33 pm, Terry Reedy wrote: > > for obj, val in zip(Orders, locus): > > obj.locus = val > > > I'm not sure how worthwhile it is converting the above to a list > > comprehension (when the list would just be thrown away). Having said > > that the call to zip creates an unnecessary list. >

Re: Assign values from list to list of instances

2011-11-01 Thread Terry Reedy
On 11/1/2011 11:37 AM, duncan smith wrote: On 01/11/11 15:05, Gnarlodious wrote: I want to assign a list of variables: locus=[-2, 21, -10, 2, 12, -11, 0, 3] updating a list of objects each value to its respective instance: for order in range(len(Orders)): Orders[order].locus=locus[order] This

Re: Assign values from list to list of instances

2011-11-01 Thread Ulrich Eckhardt
Am 01.11.2011 16:05, schrieb Gnarlodious: I want to assign a list of variables: locus=[-2, 21, -10, 2, 12, -11, 0, 3] updating a list of objects each value to its respective instance: for order in range(len(Orders)): Orders[order].locus=locus[order] This works, even though it reads lik

Re: Assign values from list to list of instances

2011-11-01 Thread duncan smith
On 01/11/11 15:05, Gnarlodious wrote: I want to assign a list of variables: locus=[-2, 21, -10, 2, 12, -11, 0, 3] updating a list of objects each value to its respective instance: for order in range(len(Orders)): Orders[order].locus=locus[order] This works, even though it reads like do

Re: Assign values from list to list of instances

2011-11-01 Thread Dave Angel
On 11/01/2011 11:05 AM, Gnarlodious wrote: I want to assign a list of variables: locus=[-2, 21, -10, 2, 12, -11, 0, 3] updating a list of objects each value to its respective instance: for order in range(len(Orders)): Orders[order].locus=locus[order] This works, even though it reads li

Re: Assign values from list to list of instances

2011-11-01 Thread Peter Otten
Gnarlodious wrote: > I want to assign a list of variables: > locus=[-2, 21, -10, 2, 12, -11, 0, 3] > > updating a list of objects each value to its respective instance: > > for order in range(len(Orders)): > Orders[order].locus=locus[order] > > This works, even though it reads like doggerel. Is

Assign values from list to list of instances

2011-11-01 Thread Gnarlodious
I want to assign a list of variables: locus=[-2, 21, -10, 2, 12, -11, 0, 3] updating a list of objects each value to its respective instance: for order in range(len(Orders)): Orders[order].locus=locus[order] This works, even though it reads like doggerel. Is there a more pythonesque way