10000 DOC: zeros, empty, and ones now have consistent docstrings by NelleV · Pull Request #10679 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

DOC: zeros, empty, and ones now have consistent docstrings #10679

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
Mar 2, 2018

Conversation

NelleV
Copy link
Contributor
@NelleV NelleV commented Mar 1, 2018

This patch simply unifies the docstrings for np.empty, np.ones, and np.zeros.

There are other inconsistencies relating to docstrings, that I decided not to fix (in matlib.py, with the same functions for matrices).

closes #10611

@eric-wieser
Copy link
Member

Note that some say shape : int or tuple of int and others shape : int or sequence of int. Documenting both as tuple would probably be better

@NelleV
Copy link
Contributor Author
NelleV commented Mar 1, 2018

As any sequences work, woudn't it be better as sequence? I always use tuple myself for that purpose, but the latter would be more accurate.

@eric-wieser
Copy link
Member
eric-wieser commented Mar 1, 2018

There are other places where we try to encourage users to use a specific convention even though a more general one is allowed. It makes it easier for us to switch to a deprecation warning in future.

Perhaps someone else should voice an opinion on that

@NelleV NelleV force-pushed the 10611_docstrings branch from 916d62f to 5a23878 Compare March 1, 2018 17:27
@NelleV
Copy link
Contributor Author
NelleV commented Mar 1, 2018

Fair enough -- I've included this change, and docstrings should be coherent on that as well now!

@godaygo
Copy link
Contributor
godaygo commented Mar 1, 2018

@eric-wieser Since the PR is already open, should I do something? I'm not very familiar with GitHub workflow :(

I want to note that additional change is needed in the signature of np.ones
np.ones(shape, dtype=None, order='C') -> np.ones(shape, dtype=float, order='C').

@charris
Copy link
Member
charris commented Mar 1, 2018

@godaygo Hmm, dtype(None) is float64, but admittedly that is uninformative and we should do something about that some day.

@NelleV
Copy link
Contributor Author
NelleV commented Mar 1, 2018

@charris Do you mean improving the documentation, or changing the argument to something more transparent?

@charris
Copy link
Member
charris commented Mar 2, 2018

@NelleV I can't decide :) But its not a big deal, so let's get this in, we can switch things around if, and when, we deprecate the current behavior of dtype(None), which isn't very intuitive.

Thanks.

@charris charris merged commit 2d44de2 into numpy:master Mar 2, 2018
@charris charris changed the title DOC zeros, empty, and ones now have consistent docstrings DOC: zeros, empty, and ones now have consistent docstrings Jun 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistency of docstrings between ones, zeros and empty.
4 participants
0