Skip to content

Commit f6dc711

Browse files
committed
chore: link to design topic
1 parent 4863912 commit f6dc711

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

spec/draft/design_topics/copies_views_and_mutation.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ standard, it remains possible to write code that will not work the same for all
7979
array libraries. This is something that the users are advised to best keep in
8080
mind and to reason carefully about the potential ambiguity of implemented code.
8181

82+
83+
.. _copy-keyword-argument:
84+
8285
Copy keyword argument behavior
8386
------------------------------
8487

src/array_api_stubs/_draft/array_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def __dlpack__(
370370
API standard.
371371
copy: Optional[bool]
372372
boolean indicating whether or not to copy the input. If ``True``, the
373-
function must always copy (performed by the producer). If ``False``, the
373+
function must always copy (performed by the producer; see also :ref:`copy-keyword-argument`). If ``False``, the
374374
function must never copy, and raise a ``BufferError`` in case a copy is
375375
deemed necessary (e.g. if a cross-device data movement is requested, and
376376
it is not possible without a copy). If ``None``, the function must reuse

src/array_api_stubs/_draft/creation_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def asarray(
111111
device: Optional[device]
112112
device on which to place the created array. If ``device`` is ``None`` and ``obj`` is an array, the output array device must be inferred from ``obj``. Default: ``None``.
113113
copy: Optional[bool]
114-
boolean indicating whether or not to copy the input. If ``True``, the function must always copy. If ``False``, the function must never copy for input which supports the buffer protocol and must raise a ``ValueError`` in case a copy would be necessary. If ``None``, the function must reuse existing memory buffer if possible and copy otherwise. Default: ``None``.
114+
boolean indicating whether or not to copy the input. If ``True``, the function must always copy (see :ref:`copy-keyword-argument`). If ``False``, the function must never copy for input which supports the buffer protocol and must raise a ``ValueError`` in case a copy would be necessary. If ``None``, the function must reuse existing memory buffer if possible and copy otherwise. Default: ``None``.
115115
116116
Returns
117117
-------

src/array_api_stubs/_draft/data_type_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def astype(
4343
dtype: dtype
4444
desired data type.
4545
copy: bool
46-
specifies whether to copy an array when the specified ``dtype`` matches the data type of the input array ``x``. If ``True``, a newly allocated array must always be returned. If ``False`` and the specified ``dtype`` matches the data type of the input array, the input array must be returned; otherwise, a newly allocated array must be returned. Default: ``True``.
46+
specifies whether to copy an array when the specified ``dtype`` matches the data type of the input array ``x``. If ``True``, a newly allocated array must always be returned (see :ref:`copy-keyword-argument`). If ``False`` and the specified ``dtype`` matches the data type of the input array, the input array must be returned; otherwise, a newly allocated array must be returned. Default: ``True``.
4747
device: Optional[device]
4848
device on which to place the returned array. If ``device`` is ``None``, the output array device must be inferred from ``x``. Default: ``None``.
4949

src/array_api_stubs/_draft/manipulation_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def reshape(
230230
shape: Tuple[int, ...]
231231
a new shape compatible with the original shape. One shape dimension is allowed to be ``-1``. When a shape dimension is ``-1``, the corresponding output array shape dimension must be inferred from the length of the array and the remaining dimensions.
232232
copy: Optional[bool]
233-
whether or not to copy the input array. If ``True``, the function must always copy. If ``False``, the function must never copy. If ``None``, the function must avoid copying, if possible, and may copy otherwise. Default: ``None``.
233+
whether or not to copy the input array. If ``True``, the function must always copy (see :ref:`copy-keyword-argument`). If ``False``, the function must never copy. If ``None``, the function must avoid copying, if possible, and may copy otherwise. Default: ``None``.
234234
235235
Returns
236236
-------

0 commit comments

Comments
 (0)