Author veky
Recipients emilyemorehouse, eric.smith, gvanrossum, hroncok, koobs, rhettinger, steven.daprano, tim.peters, veky, vstinner, xtreak
Date 2019-03-29.07:30:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1553844609.15.0.0861122325663.issue35224@roundup.psfhosted.org>
In-reply-to
Content
Now I had the opportunity to play with the walrus (as it is affectionately called in some parts of the community), I have to ask you for a reconsideration of one part of PEP 572.

    Unparenthesized assignment expressions are prohibited at the top level of an expression statement. This rule is included to simplify the choice for the user between an assignment statement and an assignment expression -- there is no syntactic position where both are valid.

Correct, but the motivation rests on a wrong premise, that the effect is the same. In one very important case, it is not: in REPL (including things like Jupyter notebooks), the values of expressions are printed (if not None). I really hoped that the walrus would enable me to both assign and see the result at once. (Now it does, but I have to parenthesize, and that just looks ugly.)

More than half of the cells in my Jupyter notebooks are of the form

    name = some.complicated.method(of={some: arguments})
    name

    another_name = another.method(name, [additional, arguments])
    another_name

And while I understand why I had to write them like this before PEP 572, now I really think they would look much tidier as

    name := some.complicated.method(of={some: arguments})

    another_name := another.method(name, [additional, arguments])

Please reconsider.
History
Date User Action Args
2019-03-29 07:30:09vekysetrecipients: + veky, gvanrossum, tim.peters, rhettinger, vstinner, eric.smith, steven.daprano, koobs, emilyemorehouse, hroncok, xtreak
2019-03-29 07:30:09vekysetmessageid: <1553844609.15.0.0861122325663.issue35224@roundup.psfhosted.org>
2019-03-29 07:30:09vekylinkissue35224 messages
2019-03-29 07:30:08vekycreate