-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Closed
Description
There is some inconsistency in docstrings for 3 frequently used constructor functions:
oneszerosempty
- The docstring for
oneslooks as follows:
ones(shape, dtype=None, order='C'):
"""
Return a new array of given shape and type, filled with ones.
Parameters
----------
shape : int or sequence of ints
Shape of the new array, e.g., ``(2, 3)`` or ``2``.
dtype : data-type, optional
The desired data-type for the array, e.g., `numpy.int8`. Default is
`numpy.float64`.
order : {'C', 'F'}, optional
Whether to store multidimensional data in C- or Fortran-contiguous
(row- or column-wise) order in memory.Interesting part here is signature ones(shape, dtype=None, order='C'), and dtype=None. While dtype description it is said that "Default is numpy.float64". For other two functions the signatures are:
zeros(shape, dtype=float, order='C')
empty(shape, dtype=float, order='C')
While they are better, they are also incorrect -> should be dtype=double or dtype=float64.
- The description of parameters for
onesandzerosa pretty identical. But for theemptyit is somewhat stripped down:
Docstring:
empty(shape, dtype=float, order='C')
Return a new array of given shape and type, without initializing entries.
Parameters
----------
shape : int or tuple of int
Shape of the empty array
dtype : data-type, optional
Desired output data-type.
order : {'C', 'F'}, optional
Whether to store multi-dimensional data in row-major
(C-style) or column-major (Fortran-style) order in
memory.Metadata
Metadata
Assignees
Labels
No labels