On Tue, Aug 25, 2015 at 10:32 AM, Cody Piersall <cody.piers...@gmail.com> wrote: > > > On Tue, Aug 25, 2015 at 9:16 AM, ast <nom...@invalid.com> wrote: >>>>> >>>>> [a,b,c,d] = 1,2,3,4 >>>>> a >> >> 1 >>>>> >>>>> b >> >> 2 >>>>> >>>>> c >> >> 3 >>>>> >>>>> d >> >> 4 >> >> I have never seen this syntax before. Is it documented. >> Is there a name for that ? >> >> thx >> -- >> https://mail.python.org/mailman/listinfo/python-list > > > That's called "sequence unpacking" > > Cody > > -- > https://mail.python.org/mailman/listinfo/python-list >
The original example is one I haven't seen in the wild. One nifty use of this feature is to exchange values like this: a, b = b, a it saves the use of a temporary name -- https://mail.python.org/mailman/listinfo/python-list