diff options
author | Johannes Schönberger <jschoenberger@demuc.de> | 2013-05-06 21:51:39 +0200 |
---|---|---|
committer | Johannes Schönberger <jschoenberger@demuc.de> | 2013-06-06 21:15:45 +0200 |
commit | 8b6ccd992e8d948438e2c39aaea8ccb156350445 (patch) | |
tree | a51bf0272fae6abb4dd0a3049d5f943dd540c916 | |
parent | 91b1b99fa01d6c9991cc833f36beef87d3c0c595 (diff) | |
download | numpy-8b6ccd992e8d948438e2c39aaea8ccb156350445.tar.gz |
Rename fill value parameter for consistency across numpy+
-rw-r--r-- | numpy/core/numeric.py | 18 | ||||
-rw-r--r-- | numpy/core/tests/test_numeric.py | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index d3199cdea..eb70c2e04 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -237,15 +237,15 @@ def ones_like(a, dtype=None, order='K', subok=True): multiarray.copyto(res, 1, casting='unsafe') return res -def filled(shape, val, dtype=None, order='C'): +def filled(shape, fill_value, dtype=None, order='C'): """ - Return a new array of given shape and type, filled with `val`. + Return a new array of given shape and type, filled with `fill_value`. Parameters ---------- shape : int or sequence of ints Shape of the new array, e.g., ``(2, 3)`` or ``2``. - val : scalar + fill_value : scalar Fill value. dtype : data-type, optional The desired data-type for the array, e.g., `numpy.int8`. Default is @@ -257,7 +257,7 @@ def filled(shape, val, dtype=None, order='C'): Returns ------- out : ndarray - Array of `val` with the given shape, dtype, and order. + Array of `fill_value` with the given shape, dtype, and order. See Also -------- @@ -280,10 +280,10 @@ def filled(shape, val, dtype=None, order='C'): """ a = empty(shape, dtype, order) - multiarray.copyto(a, val, casting='unsafe') + multiarray.copyto(a, fill_value, casting='unsafe') return a -def filled_like(a, val, dtype=None, order='K', subok=True): +def filled_like(a, fill_value, dtype=None, order='K', subok=True): """ Return a filled array with the same shape and type as a given array. @@ -292,7 +292,7 @@ def filled_like(a, val, dtype=None, order='K', subok=True): a : array_like The shape and data-type of `a` define these same attributes of the returned array. - val : scalar + fill_value : scalar Fill value. dtype : data-type, optional Overrides the data type of the result. @@ -309,7 +309,7 @@ def filled_like(a, val, dtype=None, order='K', subok=True): Returns ------- out : ndarray - Array of `val` with the same shape and type as `a`. + Array of `fill_value` with the same shape and type as `a`. See Also -------- @@ -339,7 +339,7 @@ def filled_like(a, val, dtype=None, order='K', subok=True): """ res = empty_like(a, dtype=dtype, order=order, subok=subok) - multiarray.copyto(res, val, casting='unsafe') + multiarray.copyto(res, fill_value, casting='unsafe') return res diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index 88c4bf1fe..f0cb1c1a5 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -1340,7 +1340,7 @@ class TestCreationFuncs(TestCase): def check_function(self, func, fill_value=None): fill_kwarg = {} if fill_value is not None: - fill_kwarg = {'val': fill_value} + fill_kwarg = {'fill_value': fill_value} for size in (0, 1, 2): # size in one dimension for ndims in range(self.ndims): # [], [size], [size, size] etc. shape = ndims * [size] @@ -1425,7 +1425,7 @@ class TestLikeFuncs(TestCase): def check_like_function(self, like_function, value, fill_value=False): if fill_value: - fill_kwarg = {'val': value} + fill_kwarg = {'fill_value': value} else: fill_kwarg = {} for d, dtype in self.data: |