Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rgommers
Copy link
Member

In addition to adding np.round, np.min and np.max to the html docs, this PR makes those the preferred aliases - as discussed/agreed in gh-13877.

Closes gh-22617
Closes gh-19717
Closes gh-13877

@rgommers rgommers marked this pull request as draft March 1, 2023 12:54
rgommers added 2 commits March 1, 2023 13:51
The function is more commonly called `round`, both in the array API
standard and in other array libraries (e.g., PyTorch has `round` but not
around). Plus we have `ndarray.round`.
`around` is heavily used, so keep it as an alias - but prefer `round`.
For both this switch and for keeping the alias, xref numpygh-13877.

Closes numpygh-19717
@rgommers rgommers force-pushed the depr-round-around branch from 8f6de14 to 10743b0 Compare March 1, 2023 13:52
@rgommers rgommers marked this pull request as ready for review March 1, 2023 15:01
@@ -2023,7 +2024,7 @@ def warn_if_insufficient(width, binwidth):
binary = bin(num)[2:]
binwidth = len(binary)
outwidth = (binwidth if width is None
else max(binwidth, width))
else builtins.max(binwidth, width))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope we haven't missed any of these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why we have tests I'd say:) more seriously, this is set up as spaghetti. numeric importing from fromnumeric, tweaking __module__, and then another special-case import in core/__init__.py for max makes it hard to untangle. maybe I'll really bite that bullet at some point.

@charris charris merged commit 331c20d into numpy:main Mar 1, 2023
@charris
Copy link
Member

charris commented Mar 1, 2023

Thanks Ralf.

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.

DEP: Deprecate np.round_ DOC: Explicitly mention a function's aliases in the documentation Defining overrides for aliased NumPy functions in NumPy
2 participants