summaryrefslogtreecommitdiff
path: root/numpy/lib/arraypad.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-02-16 21:36:38 -0800
committerEric Wieser <wieser.eric@gmail.com>2018-02-16 22:23:51 -0800
commite441c291b2e10c8de85a9d950d0add552d0ebd83 (patch)
treee407fc2b65b888c13f17bcb1e2654f990c2932b2 /numpy/lib/arraypad.py
parent5c5a215fa1101479ae9b8d127be32679c9f3f105 (diff)
downloadnumpy-e441c291b2e10c8de85a9d950d0add552d0ebd83.tar.gz
MAINT: Stop using non-tuple indices internally
By not using this type of indexing, it becomes easier for subclasses to override indexing in a way that works correctly with numpy functions. These locations were found by deprecating the behavior in question, which is deliberately not part of this commit
Diffstat (limited to 'numpy/lib/arraypad.py')
-rw-r--r--numpy/lib/arraypad.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/lib/arraypad.py b/numpy/lib/arraypad.py
index cdc354a02..daaa68d06 100644
--- a/numpy/lib/arraypad.py
+++ b/numpy/lib/arraypad.py
@@ -1346,9 +1346,9 @@ def pad(array, pad_width, mode, **kwargs):
# Create a new padded array
rank = list(range(narray.ndim))
total_dim_increase = [np.sum(pad_width[i]) for i in rank]
- offset_slices = [slice(pad_width[i][0],
- pad_width[i][0] + narray.shape[i])
- for i in rank]
+ offset_slices = tuple(
+ slice(pad_width[i][0], pad_width[i][0] + narray.shape[i])
+ for i in rank)
new_shape = np.array(narray.shape) + total_dim_increase
newmat = np.zeros(new_shape, narray.dtype)