summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
authorAntony Lee <anntzer.lee@gmail.com>2015-09-28 11:02:15 -0700
committerAntony Lee <anntzer.lee@gmail.com>2015-09-28 11:02:15 -0700
commit649d19ff0ec5bba1fe0e89402d7cc8c4597ea170 (patch)
tree621f0d063351858edddd7af8cfddc1faf79e181a /numpy/core/numeric.py
parent986a98c8020f90ae95dd65817a2dcc5e5f336172 (diff)
downloadnumpy-649d19ff0ec5bba1fe0e89402d7cc8c4597ea170.tar.gz
FutureWarning for np.full(..., non-float).
cf. discussion in #6366.
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 1b7dfca3e..5d4464ea7 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -258,8 +258,9 @@ 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., `numpy.int8`. Default is
- is chosen as `np.array(fill_value).dtype`.
+ 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.
order : {'C', 'F'}, optional
Whether to store multidimensional data in C- or Fortran-contiguous
(row- or column-wise) order in memory.
@@ -290,6 +291,10 @@ def full(shape, fill_value, dtype=None, order='C'):
"""
a = empty(shape, dtype, order)
+ if array(fill_value).dtype != a.dtype:
+ warnings.warn(
+ "in the future, full(..., {0!r}) will return an array of {1!r}".
+ format(fill_value, array(fill_value).dtype), FutureWarning)
multiarray.copyto(a, fill_value, casting='unsafe')
return a