While reading through the Python 3 Lexical analysis, I became slightly confused by the last section on operators[1] and delimiters. The @
character is listed as both an operator and a delimiter, and @=
is also listed as an augmented assignment operator. Following the form of other augmented assignment operators, I would expect this to mean that the @
character can be used like so:
x = x @ y
or
x @= y
I have tried using it in this way with integers and strings without any success. I am familiar with using @
for decorators, but fail to see how an augmented assignment operator is compatible with decorators.
What is the purpose of @
and @=
when used as an operator and/or delimiter in Python 3?
[1] Python 3 - Operators: https://docs.python.org/3/reference/lexical_analysis.html#operators