diff options
Diffstat (limited to 'numpy/lib/index_tricks.py')
-rw-r--r-- | numpy/lib/index_tricks.py | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py index c77424f71..06ec80d23 100644 --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['ravel_multi_index', 'unravel_index', @@ -16,9 +16,9 @@ from numpy.core.numeric import ( asarray, ScalarType, array, alltrue, cumprod, from numpy.core.numerictypes import find_common_type import math -import function_base +from . import function_base import numpy.matrixlib as matrix -from function_base import diff +from .function_base import diff from numpy.lib._compiled_base import ravel_multi_index, unravel_index from numpy.lib.stride_tricks import as_strided makemat = matrix.matrix @@ -307,7 +307,7 @@ class AxisConcatenator(object): k2 = ndmin-tempobj.ndim if (trans1d < 0): trans1d += k2 + 1 - defaxes = range(ndmin) + defaxes = list(range(ndmin)) k1 = trans1d axes = defaxes[:k1] + defaxes[k2:] + \ defaxes[k1:k2] @@ -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] |