summaryrefslogtreecommitdiff
path: root/numpy/core/defmatrix.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-02-24 10:50:02 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-02-24 10:50:02 +0000
commitb18d25b368aaee7f4617ed250e0201903fb42440 (patch)
treeb0dcdc3d21ec660976caee39ac00c4772602f7b1 /numpy/core/defmatrix.py
parent24a8d329deff1e63c40460fe41f72dc420ade1c9 (diff)
downloadnumpy-b18d25b368aaee7f4617ed250e0201903fb42440.tar.gz
Faster return.
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r--numpy/core/defmatrix.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py
index 65339793a..61d23eac9 100644
--- a/numpy/core/defmatrix.py
+++ b/numpy/core/defmatrix.py
@@ -101,11 +101,14 @@ class matrix(N.ndarray):
def __array_finalize__(self, obj):
ndim = self.ndim
+ if (ndim == 2):
+ return
if (ndim > 2):
newshape = tuple([x for x in self.shape if x > 1])
ndim = len(newshape)
if ndim == 2:
self.shape = newshape
+ return
elif (ndim > 2):
raise ValueError, "shape too large to be a matrix."
if ndim == 0: