Syntactic sugar for assignment statements: one value to multiple targets?

Martin P. Hellwig martin.hellwig at gmail.com
Tue Aug 16 16:39:34 EDT 2011


On 03/08/2011 02:45, gc wrote:
<cut>
> a,b,c,d,e = *dict()
>
> where * in this context means something like "assign separately to
> all.
<CUT>
> Any thoughts? Thanks!

Well got a thought but I am afraid it is the opposite of helpful in the 
direct sense. So if you don't want to hear it skip it :-)

Although I can not proficiently argument it, it has a certain code smell 
to it. In the sense that it could hint that there is a better more 
readable way of solving that particular problem (taking in account that 
the one letter labels are pure for demonstration purpose).

I would love to see an example where you would need such a construct.

-- 
mph




More information about the Python-list mailing list