
May 27, 2016
2:43 a.m.
On 26/05/2016 18:55, Ethan Furman wrote:
With the simple syntax that I could live with, a real example could be:
{active_id, active_ids, active_model} = context
or
{partner_id, product_id, ship_to, product_ids} = values
which is more readable than
(partner_id, product_id, ship_to, product_ids = (values[k] for k in ['partner_id', 'product_id', 'ship_to', 'product_ids']))
Wow. That's a lot of room for typos and wrong order.
How about locals().update(values) or if you just want a subset for k in ['partner_id', 'product_id', 'ship_to', 'product_ids']: locals()[k] = values[k] # Look Ma, DRY