def __getitem__(self, i): if 0 <= i < len(self): return API.getEntry(self._vector, i) else: raise IndexError
def __getitem__(self, ij): i, j = ij return API.getEntry(self._matrix, i, j)