On Thu., 5 Jul. 2018, 3:17 pm Guido van Rossum, <gu...@python.org> wrote:
> Let me be slightly contrarian. :-) > > On Wed, Jul 4, 2018 at 9:12 PM Chris Angelico <ros...@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. > >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com