[Python-ideas] On evaluating features [was: Unpacking iterables for augmented assignment]

Jonathan Fine jfine2358 at gmail.com
Thu Sep 6 14:33:46 EDT 2018

Hi Franklin Lee

Thank you for your message. You wrote:

> We can translate the original example:
>     a, b, c += x, y, z
> to:
>     a, b, c = target_list(a,b,c).__iadd__((x,y,z))
> where `target_list` is a virtual (not as in "virtual function") type
> for target list constructs.

Yes, we can.I think all are agreed that that such semantics for

      a, b, c += x, y, z

could be provided in a future version of Python.  At present we get

       >>> a, b, c += [4, 5, 6]
      SyntaxError: illegal expression for augmented assignment

Where we're not agreed, I think, is whether doing so would be a good
idea. The proposers think it is a good idea. However, unless the
proposers convince sufficient users that it is a good idea to do so,
it probably won't be added to Python.

By the way, I think it's easier to get users for a pure Python module
(and hence perhaps get it into the standard library) than it is to
make a language syntax and semantics change. And I also like that
things are this way.


More information about the Python-ideas mailing list