[Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

Mikhail V mikhailwas at gmail.com
Mon Apr 16 15:42:22 EDT 2018


On Mon, Apr 16, 2018 at 8:42 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Mon, Apr 16, 2018 at 11:05 PM, Mikhail V <mikhailwas at gmail.com> wrote:
>
> Here are the three most popular syntax options, and how each would be explained:
>
> 1) "target := expr" ==> It's exactly the same as other forms of
> assignment, only now it's an expression.
> 2) "expr as name" ==> It's exactly the same as other uses of "as",
> only now it's just grabbing the preceding expression, not actually
> doing anything with it
> 3) "expr -> name" ==> The information went data way.


As I initially said, I just don't find this choice list fair.
and it should be:

1) "target = expr"  (which would be first intuitive idea from user's PoV,
and if can't be made then explained to Python people why not)

2) "target := expr" (as probably best close alternative)

3) "target ? expr" (where ? is some other word/character -  IIRC
  "target from expr" was proposed once)


That's it.
But well, if I compare to your choice list - there is ":=" option you
have as well :)


More information about the Python-ideas mailing list