Assign values from list to list of instances

Gnarlodious gnarlodious at gmail.com
Wed Nov 2 00:52:16 EDT 2011


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.
>
> Not in Py 3

Thanks for that tip, this works well in Py3.

-- Gnarlie



More information about the Python-list mailing list