[Python-ideas] The @update operator for dictionaries
steve at pearwood.info
Sat Mar 9 11:49:14 EST 2019
On Sat, Mar 09, 2019 at 04:34:01PM +0000, Jonathan Fine wrote:
> There are (many) numbers between 1 and infinity. If a programmer
> defines __at_python__ on type(guido) then guido at python will have
It already has meaning: it calls the @ operator with operands "guido"
> Steve wrote:
> > New syntax which breaks existing code is not likely to be
> > accepted without a *really* good reason.
> 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
The interpreter doesn't distinguish between "a @ b" and "a at b".
Spaces around operators are always optional.
The last thing we're going to do is repeat Ruby's design mistake of
making code dependent on spaces around operators. Define a function in
Ruby with a default value:
and then evaluate the expressions:
a + 1
The results you get will be 7, 7, 7 and 3.
More information about the Python-ideas