Skip to content

Commit ab7b7fe

Browse files
author
Bas van Beek
committed
DOC: Update the docstrings of __array_prepare__ and __array_wrap__
* Add the previously missing `context` parameter * Make all arguments positional-only * Rename the `obj` parameter to `array`, just as is done in the `__array_prepare__` / `__array_wrap__` docs * Reworded the 1-line summary
1 parent a7c09a3 commit ab7b7fe

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

numpy/core/_add_newdocs.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@
15851585
For integer arguments the function is equivalent to the Python built-in
15861586
`range` function, but returns an ndarray rather than a list.
15871587
1588-
When using a non-integer step, such as 0.1, it is often better to use
1588+
When using a non-integer step, such as 0.1, it is often better to use
15891589
`numpy.linspace`. See the warnings section below for more information.
15901590
15911591
Parameters
@@ -2771,13 +2771,17 @@
27712771

27722772

27732773
add_newdoc('numpy.core.multiarray', 'ndarray', ('__array_prepare__',
2774-
"""a.__array_prepare__(obj) -> Object of same type as ndarray object obj.
2774+
"""a.__array_prepare__(array[, context], /)
2775+
2776+
Returns a view of `array` with the same type as self.
27752777
27762778
"""))
27772779

27782780

27792781
add_newdoc('numpy.core.multiarray', 'ndarray', ('__array_wrap__',
2780-
"""a.__array_wrap__(obj) -> Object of same type as ndarray object a.
2782+
"""a.__array_wrap__(array[, context], /)
2783+
2784+
Returns a view of `array` with the same type as self.
27812785
27822786
"""))
27832787

0 commit comments

Comments
 (0)