I know @
is for decorators, but what is @=
for in Python? Is it just reservation for some future idea?
This is just one of my many questions while reading tokenizer.py
.
From the documentation:
The
@
(at) operator is intended to be used for matrix multiplication. No builtin Python types implement this operator.
The @
operator was introduced in Python 3.5. @=
is matrix multiplication followed by assignment, as you would expect. They map to __matmul__
, __rmatmul__
or __imatmul__
similar to how +
and +=
map to __add__
, __radd__
or __iadd__
.
The operator and the rationale behind it are discussed in detail in PEP 465.