[Python-ideas] PEP 572: about the operator precedence of :=

Guido van Rossum guido at python.org
Thu May 10 09:57:22 EDT 2018


On Thu, May 10, 2018 at 5:04 AM, M.-A. Lemburg <mal at egenix.com> wrote:

> To a (former Pascal) programmer, a := 1 doesn't read like an
> operator. It's an assignment expression. If embedded expressions
> is where Python is heading, it should be made very clear where
> the embedded expression starts and where it ends on a line.
>

The rules we've arrived at are about as straightforward as it gets: the RHS
of `:=` ends at the nearest comma or close parenthesis/bracket/brace.

OT about the name: despite Tim's relentless pushing of "binding
expressions" in the end I think they should be called "assignment
expressions" just like in C.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180510/002aef93/attachment.html>


More information about the Python-ideas mailing list