[a,b,c,d] = 1,2,3,4
Chris Angelico
rosuav at gmail.com
Wed Aug 26 09:04:05 EDT 2015
- Previous message (by thread): [a,b,c,d] = 1,2,3,4
- Next message (by thread): [a,b,c,d] = 1,2,3,4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
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
- Previous message (by thread): [a,b,c,d] = 1,2,3,4
- Next message (by thread): [a,b,c,d] = 1,2,3,4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-list
mailing list