[a,b,c,d] = 1,2,3,4

Chris Angelico rosuav at gmail.com
Wed Aug 26 15:04:05 CEST 2015

On Wed, Aug 26, 2015 at 12:59 AM, Jean-Michel Pichavant
<jeanmichel at sequans.com> wrote:
> To add to Joel's answer, the right side can be *any* sequence, and is not restricted to lists or tuples.
> a, b, c = (x for x in range(3)) # a generator for instance

FWIW, a generator is not a sequence; this works because the right side
can be any *iterable*, even more general than sequences.


More information about the Python-list mailing list