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

Jean-Michel Pichavant jeanmichel at sequans.com
Wed Aug 26 15:29:24 CEST 2015

----- Original Message -----
> From: "Chris Angelico" <rosuav at gmail.com>
> Cc: python-list at python.org
> Sent: Wednesday, 26 August, 2015 3:04:05 PM
> Subject: Re: [a,b,c,d] = 1,2,3,4
> 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.
> ChrisA

Sorry about that, I've been mislead by the tutorial which uses sequence where it should have used iterable, so I though they where the same but they're not.

"There are seven sequence types: strings, Unicode strings, lists, tuples, bytearrays, buffers, and xrange objects."

I stand corrected.



The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

More information about the Python-list mailing list