diff options
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r-- | numpy/core/defmatrix.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py index d76eafea3..839c4f058 100644 --- a/numpy/core/defmatrix.py +++ b/numpy/core/defmatrix.py @@ -205,7 +205,14 @@ class matrix(N.ndarray): return NotImplemented def __repr__(self): - return repr(self.__array__()).replace('array','matrix') + s = repr(self.__array__()).replace('array', 'matrix') + # now, 'matrix' has 6 letters, and 'array' 5, so the columns don't + # line up anymore. We need to add a space. + l = s.splitlines() + for i in range(1, len(l)): + if l[i]: + l[i] = ' ' + l[i] + return '\n'.join(l) def __str__(self): return str(self.__array__()) |