Skip to content

Commit bff75cf

Browse files
committed
DOC: Add _dunder_array reference
1 parent 1f35b27 commit bff75cf

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

doc/source/numpy_2_0_migration_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ The :ref:`copy keyword behavior changes <copy-keyword-changes-2.0>` in
423423
* For any ``__array__`` method on a non-NumPy array-like object, ``dtype=None``
424424
and ``copy=None`` keywords must be added to the signature - this will work with older
425425
NumPy versions as well (although older numpy versions will never pass in ``copy`` keyword).
426-
If the keywords are actually used in the ``__array__`` method implementation, then for:
426+
If the keywords are added to the ``__array__`` signature, then for:
427427

428428
* ``copy=True`` and any ``dtype`` value always return a new copy,
429429
* ``copy=None`` create a copy if required (for example by ``dtype``),

doc/source/user/basics.interoperability.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ We can check that ``arr`` and ``new_arr`` share the same data buffer:
113113
array([1000, 2, 3, 4])
114114

115115

116+
.. _dunder_array.interface:
117+
116118
The ``__array__()`` method
117119
~~~~~~~~~~~~~~~~~~~~~~~~~~
118120

numpy/_core/_add_newdocs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2954,6 +2954,9 @@
29542954
parameter. The method returns a new array for ``copy=True``, regardless of
29552955
``dtype`` parameter.
29562956
2957+
A more detailed explanation of the ``__array__`` interface
2958+
can be found in :ref:`dunder_array.interface`.
2959+
29572960
"""))
29582961

29592962

0 commit comments

Comments
 (0)