[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
Rob Cliffe
rob.cliffe at btinternet.com
Mon Jul 2 17:46:56 EDT 2018
On 02/07/2018 19:19, Guido van Rossum wrote:
> Thank you all. I will accept the PEP as is. I am happy to accept
> *clarification* updates to the PEP if people care to submit them as
> PRs to the peps repo (https://github.com/python/peps), and that could
> even (to some extent) include summaries of discussion we've had, or
> outright rejected ideas. But even without any of those I think the PEP
> is very clear so I will not wait very long (maybe a week).
>
It's late to raise this, but what exactly are the objections to the syntax
expr -> name # or variations such as expr => name
instead of
name := expr
The PEP mentions that this syntax does not have a problem that "as"
does, but does not list any downsides of it.
It conforms to left-to-right evaluation, where name:=expr does not.
It (I would argue) reduces the asymmetry of the first use of a
sub-expression in cases such as
[ ( (f(x) -> y)**2, y**3, y**4) for x in iterable ]
vs
[ ( (y := f(x))**2, y**3, y**4) for x in iterable ]
because the first "y" is closer to the way it is used, viz "**2".
Regards
Rob Cliffe
More information about the Python-Dev
mailing list