8000 backport gh-6382 by charris · Pull Request #6383 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

backport gh-6382 #6383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions numpy/core/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,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.
Expand Down Expand Up @@ -287,6 +288,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

Expand Down
0