[Python-Dev] PEP 572 semantics: all capabilities of the assignment statement
Nick Coghlan
ncoghlan at gmail.com
Thu Jul 5 18:44:46 EDT 2018
More information about the Python-Dev mailing list
Thu Jul 5 18:44:46 EDT 2018
- Previous message (by thread): [Python-Dev] PEP 572 semantics: all capabilities of the assignment statement
- Next message (by thread): [Python-Dev] PEP 572 semantics: all capabilities of the assignment statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu., 5 Jul. 2018, 3:17 pm Guido van Rossum, <guido at python.org> wrote: > Let me be slightly contrarian. :-) > > On Wed, Jul 4, 2018 at 9:12 PM Chris Angelico <rosuav at gmail.com> wrote: > >> Definitely against augmentation, for several reasons: >> >> 1) Spelling - should it be :+= or +:= ? >> > > That one's easy. As Nick's (withdrawn) PEP 577 shows it should be simply > `+=`. > > >> 2) Is the result of the expression the modified value or the original? >> > > Someone (sadly I forget who) showed, convincingly (to me anyways :-) that > it should return whatever the `__iadd__` method returns, or (if there isn't > one) the result of `a = a + b`. > I think I had it as an open question in one of the earlier drafts of PEP 577. The subsequent rationale for it returning the modified value was that we have this existing equivalence at the statement level: a += b a = operator.iadd(a, b) So the natural expression level semantics would be: a := operator.iadd(a, b) Cheers, Nick. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180706/9bc9eed6/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 572 semantics: all capabilities of the assignment statement
- Next message (by thread): [Python-Dev] PEP 572 semantics: all capabilities of the assignment statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list