1"""Use cases for testing matmul (@) 2""" 3def matmul_usecase(x, y): 4 return x @ y 5 6def imatmul_usecase(x, y): 7 x @= y 8 return x 9 10class DumbMatrix(object): 11 12 def __init__(self, value): 13 self.value = value 14 15 def __matmul__(self, other): 16 if isinstance(other, DumbMatrix): 17 return DumbMatrix(self.value * other.value) 18 return NotImplemented 19 20 def __imatmul__(self, other): 21 if isinstance(other, DumbMatrix): 22 self.value *= other.value 23 return self 24 return NotImplemented 25