I think I tried a variation of your proposal here https://mail.python.org/pipermail/python-dev/2018-April/152939.html and nobody really liked it.
Yury On Thu, Jul 5, 2018 at 7:44 PM Alexander Belopolsky <alexander.belopol...@gmail.com> wrote: > > I wish I had more time to make my case, but with the PEP 572 pronouncement > imminent, let me make an attempt to save Python from having two assignment > operators. > > I've re-read the PEP, and honestly I am warming up to the idea of allowing a > limited form of assignment in expressions. It looks like in the current > form, the PEP supports only well-motivated cases where the return value of > the assignment expression is non-controversial. It also appears that there > are no cases where = can be substituted for := and not cause a syntax error. > This means that ":" in ":=" is strictly redundant. > > Interestingly, Python already has a precedent for using redundant ":" - the > line-ending ":" in various statements is redundant, but it is helpful both > when reading and writing the code. > > On the other hand, ':' in ':=' looks like an unnecessary embellishment. When > we use ':=', we already know that we are inside an expression and being > inside an expression is an obvious context for the reader, the writer and the > interpreter. > > I also believe, allowing a limited form of assignment in expressions is a > simpler story to tell to the existing users than an introduction of a new > operator that is somewhat like '=', but cannot be used where you currently > use '=' and only in places where '=' is currently prohibited. > > _______________________________________________ > 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/yselivanov.ml%40gmail.com -- Yury _______________________________________________ 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