I have built a wrapper around numpy array for simplification purposes I will display only the necessary part to show the error:
class Matrix(object): """wrap around numpy array """ def __init__(self, shape, fill_value): self.matrix = np.full(shape, fill_value) def __getitem__(self, a, b): return self.matrix[a, b] m = Matrix((10, 10), 5) print(m[5, 5]) the print statement generates the following error:
KeyError: __getitem__() takes exactly 3 arguments (2 given) what's the fix to access m using the [] operator like the follwing:
m[1, 1]