diff options
author | Antony Lee <anntzer.lee@gmail.com> | 2016-01-21 17:17:38 -0800 |
---|---|---|
committer | Antony Lee <anntzer.lee@gmail.com> | 2016-03-20 09:02:34 -0700 |
commit | a073198864e18dab7fc78653a69175fa6c76e345 (patch) | |
tree | 1f7b37d5a1d3793bfdbbdd8b8c548c4db61ec608 /numpy/core/numeric.py | |
parent | 41ec9fc8b7ee9b710c3054b9e9409a7a1f6082f7 (diff) | |
download | numpy-a073198864e18dab7fc78653a69175fa6c76e345.tar.gz |
MAINT: np.full defaults to the filler's dtype.
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 551d63a01..7f1206855 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -262,9 +262,8 @@ def full(shape, fill_value, dtype=None, order='C'): fill_value : scalar Fill value. dtype : data-type, optional - The desired data-type for the array, e.g., `np.int8`. Default - is `float`, but will change to `np.array(fill_value).dtype` in a - future release. + The desired data-type for the array The default, `None`, means + `np.array(fill_value).dtype`. order : {'C', 'F'}, optional Whether to store multidimensional data in C- or Fortran-contiguous (row- or column-wise) order in memory. @@ -289,16 +288,14 @@ def full(shape, fill_value, dtype=None, order='C'): >>> np.full((2, 2), np.inf) array([[ inf, inf], [ inf, inf]]) - >>> np.full((2, 2), 10, dtype=np.int) + >>> np.full((2, 2), 10) array([[10, 10], [10, 10]]) """ + if dtype is None: + dtype = array(fill_value).dtype a = empty(shape, dtype, order) - if dtype is None and array(fill_value).dtype != a.dtype: - warnings.warn( - "in the future, full({0}, {1!r}) will return an array of {2!r}". - format(shape, fill_value, array(fill_value).dtype), FutureWarning) multiarray.copyto(a, fill_value, casting='unsafe') return a |