diff options
author | Lars G <lagru@mailbox.org> | 2018-05-02 17:39:24 +0200 |
---|---|---|
committer | Lars G <lagru@mailbox.org> | 2018-05-02 17:39:24 +0200 |
commit | a5f94a90adc15a4a5fb417a1fb5c6d4338b899a0 (patch) | |
tree | 40ef8729559aaab09ca4ee85d5e9db2c76c806e5 /numpy/lib/arraypad.py | |
parent | 51ef0c409e20490829218c4d549a3bd4c9b073a2 (diff) | |
download | numpy-a5f94a90adc15a4a5fb417a1fb5c6d4338b899a0.tar.gz |
MAINT: Simplify workflow in _append_const and _prepend_const
Diffstat (limited to 'numpy/lib/arraypad.py')
-rw-r--r-- | numpy/lib/arraypad.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/numpy/lib/arraypad.py b/numpy/lib/arraypad.py index 9f33753b7..97ba12348 100644 --- a/numpy/lib/arraypad.py +++ b/numpy/lib/arraypad.py @@ -100,12 +100,8 @@ def _prepend_const(arr, pad_amt, val, axis=-1): return arr padshape = tuple(x if i != axis else pad_amt for (i, x) in enumerate(arr.shape)) - if val == 0: - return np.concatenate((np.zeros(padshape, dtype=arr.dtype), arr), - axis=axis) - else: - return np.concatenate((np.full(padshape, val, dtype=arr.dtype), arr), - axis=axis) + return np.concatenate((np.full(padshape, val, dtype=arr.dtype), arr), + axis=axis) def _append_const(arr, pad_amt, val, axis=-1): @@ -134,12 +130,8 @@ def _append_const(arr, pad_amt, val, axis=-1): return arr padshape = tuple(x if i != axis else pad_amt for (i, x) in enumerate(arr.shape)) - if val == 0: - return np.concatenate((arr, np.zeros(padshape, dtype=arr.dtype)), - axis=axis) - else: - return np.concatenate((arr, np.full(padshape, val, dtype=arr.dtype)), - axis=axis) + return np.concatenate((arr, np.full(padshape, val, dtype=arr.dtype)), + axis=axis) def _prepend_edge(arr, pad_amt, axis=-1): |