
On Thu, May 26, 2016 at 1:52 AM, Michael Selik <michael.selik@gmail.com> wrote: [...]
On Wed, May 25, 2016 at 4:14 PM Ethan Furman <ethan@stoneleaf.us> wrote:
The proposal is this: a, b = **mapping
The advantages: - much more readable - less duplication
Why doesn't that work for tuple unpacking? py> a, b = *iterable SyntaxError
Whatever the reasons, that syntax wasn't chosen for tuple unpacking. Dict unpacking should mimic tuple unpacking. If I saw ``a, b = **mapping`` I would expect ``a, b = *iterable``.
I think it would make sense to allow a, b = *iterable That would be more explicit about unpacking the iterable. Still, in clear cases like `a, b = 1, 2`, one could omit the asterisk. After all, this already works: a, b, c = 1, *(2, 3) Some more examples: a, b = 1, 2 # this is clear a, b = *(1,2) # could be legal and equivalent to the above a = *(1, 2) # would fail, and should fail! a = 1, 2 # does not fail So why not allow being more explicit about unpacking? -- Koos