[Python-ideas] The @update operator for dictionaries

Chris Angelico rosuav at gmail.com
Sat Mar 9 11:43:53 EST 2019


On Sun, Mar 10, 2019 at 3:37 AM Jonathan Fine <jfine2358 at gmail.com> wrote:
> I'd like to see some real-world examples of code that would be broken.
> As I recall, most or all of the code examples in the python-ideas
> thread on the '@' operator actually write ' @ '. So they would be
> good.
> https://mail.python.org/pipermail/python-ideas/2014-March/027053.html
>

Can you start by actually defining the change to the grammar? You've
casually thrown out the comment that there'll be breakage, without
saying exactly what you're proposing to change.

Currently, "x @ y" is defined as an operator, with the same precedence
as other multiplication/division operators:

https://github.com/python/cpython/blob/master/Grammar/Grammar#L106

If the actual Grammar file is too hard to work with, define in high
level terms what you're trying to change, perhaps by referencing this
table:

https://docs.python.org/3/reference/expressions.html#operator-precedence

ChrisA


More information about the Python-ideas mailing list