summaryrefslogtreecommitdiffstats
path: root/Lib/operator.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-04-10 03:55:56 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-04-10 03:55:56 (GMT)
commitd51374ed78a3e3145911a16cdf3b9b84b3ba7d15 (patch)
tree31f9086f20f5b8923604f41f1a4d139fa809aaed /Lib/operator.py
parent2aad6ef77419887f5875ba942e9369b4bdd34a5e (diff)
downloadcpython-d51374ed78a3e3145911a16cdf3b9b84b3ba7d15.zip
cpython-d51374ed78a3e3145911a16cdf3b9b84b3ba7d15.tar.gz
cpython-d51374ed78a3e3145911a16cdf3b9b84b3ba7d15.tar.bz2
PEP 465: a dedicated infix operator for matrix multiplication (closes #21176)
Diffstat (limited to 'Lib/operator.py')
-rw-r--r--Lib/operator.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/operator.py b/Lib/operator.py
index b60349f..856036d 100644
--- a/Lib/operator.py
+++ b/Lib/operator.py
@@ -105,6 +105,10 @@ def mul(a, b):
"Same as a * b."
return a * b
+def matmul(a, b):
+ "Same as a @ b."
+ return a @ b
+
def neg(a):
"Same as -a."
return -a
@@ -326,6 +330,11 @@ def imul(a, b):
a *= b
return a
+def imatmul(a, b):
+ "Same as a @= b."
+ a @= b
+ return a
+
def ior(a, b):
"Same as a |= b."
a |= b
@@ -383,6 +392,7 @@ __invert__ = invert
__lshift__ = lshift
__mod__ = mod
__mul__ = mul
+__matmul__ = matmul
__neg__ = neg
__or__ = or_
__pos__ = pos
@@ -403,6 +413,7 @@ __ifloordiv__ = ifloordiv
__ilshift__ = ilshift
__imod__ = imod
__imul__ = imul
+__imatmul__ = imatmul
__ior__ = ior
__ipow__ = ipow
__irshift__ = irshift