Skip to content

Commit 9a3fc5b

Browse files
crusaderkykgryte
andauthored
docs: clarify __setitem__ type promotion rules for array values
PR-URL: #920 Closes: #916 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent 8067560 commit 9a3fc5b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/array_api_stubs/_draft/array_object.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,8 +1134,10 @@ def __setitem__(
11341134
Indexing semantics when ``key`` is an integer array or a tuple of integers and integer arrays is currently unspecified and thus implementation-defined. This will be revisited in a future revision of this standard.
11351135
11361136
- Setting array values must not affect the data type of ``self``.
1137-
- When ``value`` is a Python scalar (i.e., ``int``, ``float``, ``complex``, ``bool``), behavior must follow specification guidance on mixing arrays with Python scalars (see :ref:`type-promotion`).
1138-
- When ``value`` is an ``array`` of a different data type than ``self``, how values are cast to the data type of ``self`` is implementation defined.
1137+
- ``value`` must be promoted to the data type of ``self`` according to :ref:`type-promotion`. If this is not supported according to :ref:`type-promotion`, behavior is unspecified and thus implementation-defined.
1138+
1139+
.. versionchanged:: 2025.12
1140+
Specified :ref:`type-promotion` when ``value`` is an array.
11391141
"""
11401142

11411143
def __sub__(self: array, other: Union[int, float, complex, array], /) -> array:

0 commit comments

Comments
 (0)