From 48783e5ceb7f60c33db81ab72e5024f42b220990 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Fri, 24 Feb 2017 16:46:58 +0000 Subject: MAINT: replace len(x.shape) with x.ndim --- numpy/lib/user_array.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/lib/user_array.py') diff --git a/numpy/lib/user_array.py b/numpy/lib/user_array.py index 62398fc3c..f1510a7b1 100644 --- a/numpy/lib/user_array.py +++ b/numpy/lib/user_array.py @@ -34,7 +34,7 @@ class container(object): self.array = array(data, dtype, copy=copy) def __repr__(self): - if len(self.shape) > 0: + if self.ndim > 0: return self.__class__.__name__ + repr(self.array)[len("array"):] else: return self.__class__.__name__ + "(" + repr(self.array) + ")" @@ -183,7 +183,7 @@ class container(object): return self._rc(invert(self.array)) def _scalarfunc(self, func): - if len(self.shape) == 0: + if self.ndim == 0: return func(self[0]) else: raise TypeError( -- cgit v1.2.1