[Python-ideas] Unpack of sequences

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Aug 29 21:24:30 CEST 2012

On Wed, Aug 29, 2012 at 2:21 PM, Guido van Rossum <guido at python.org> wrote:
>> {a, b, c} = m
> But {a, b, c} is already a set. I'd expect set-like semantics, perhaps
> assigning the keys of a 3-element set in arbitrary order to the
> variables a, b and c.

I considered this before posting and I think the potential for such
confusion is rather low.  We already allow [a,b,c] = and (a,b,c) =
even though tuples are supposed to be immutable and (a,b,c) = may look
like a syntax error to someone unfamiliar with unpacking.  I don't see
much of a problem with having the same syntactic elements have
different meaning when they appear as in an assignment target.

More information about the Python-ideas mailing list