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

Gregory P. Smith greg at krypto.org
Mon Apr 16 21:27:30 EDT 2018


On Mon, Apr 16, 2018 at 11:11 AM Ned Batchelder <ned at nedbatchelder.com>
wrote:

> On 4/16/18 1:42 PM, Chris Angelico wrote:
> > 3) "expr -> name" ==> The information went data way.
> >
> > So either you take a parallel from elsewhere in Python syntax, or you
> > take a hopefully-intuitive dataflow mnemonic symbol. Take your pick.
>
> My problem with the "->" option is that function annotations already use
> "->" to indicate the return type of a function.  This is an unfortunate
> parallel from elsewhere in Python syntax, since the meaning is
> completely different.
>
> ":=" is at least new syntax.
>
> "as" is nice in that it's already used for assignment, but seems to be
> causing too much difficulty in parsing, whether by compilers or people.
>
>
FWIW - We used "as" in our Python C++ binding interface description
language in CLIF to denote renaming from the original C++ name to a new
name in Python - effectively an assignment syntax.
   https://github.com/google/clif/blob/master/clif/python/primer.md

I currently have a "-0" opinion on the entire PEP 572 as I don't buy that
assignments within expressions are even a good thing to have in the
language.  #complexity - Think of people learning the language.

-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180417/ff1dd285/attachment.html>


More information about the Python-ideas mailing list