diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-01 12:53:36 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-01 12:53:36 -0700 |
commit | d3edb4e84e3630320a3f577a83113f086cc1b563 (patch) | |
tree | b041b070ab9d5f3051e7db34e272431397b4b849 /numpy/lib/index_tricks.py | |
parent | fd6f038b2e003588d3c0f75a6111b3eb8616f40f (diff) | |
parent | aa4d003598e66ff7c8392544d56ecdcc76493133 (diff) | |
download | numpy-d3edb4e84e3630320a3f577a83113f086cc1b563.tar.gz |
Merge pull request #3104 from seberg/nditer-allow-0d
Make AdvancedNew iter more 0-d aware
Diffstat (limited to 'numpy/lib/index_tricks.py')
-rw-r--r-- | numpy/lib/index_tricks.py | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py index 07e7c1e39..dc57c1048 100644 --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -532,30 +532,7 @@ class ndindex(object): (2, 0, 0) (2, 1, 0) - """ - # This is a hack to handle 0-d arrays correctly. - # Fixing nditer would be more work but should be done eventually, - # and then this entire __new__ method can be removed. - def __new__(cls, *shape): - if len(shape) == 1 and isinstance(shape[0], tuple): - shape = shape[0] - if len(shape) == 0: - class zero_dim_iter(object): - def __init__(self): - self._N = 1 - def __iter__(self): - return self - def ndincr(self): - self.next() - def next(self): - if self._N > 0: - self._N -= 1 - return () - raise StopIteration - return zero_dim_iter() - else: - return super(ndindex, cls).__new__(cls) - + """ def __init__(self, *shape): if len(shape) == 1 and isinstance(shape[0], tuple): shape = shape[0] |