Skip to content

Commit 4294f43

Browse files
honnokgryte
andauthored
Require in-place operations match binary operation equivalents (#299)
* Clarify in-place operations mirror special case behaviour * Clarify that in-place ops follow all functionality of standard ops * Update copy Co-authored-by: Athan <kgryte@gmail.com>
1 parent 7c98b00 commit 4294f43

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spec/API_specification/array_object.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ an array object supporting the following in-place Python operators:
156156
An in-place operation must not change the dtype or shape of the in-place array
157157
as a result of {ref}`type-promotion` or {ref}`broadcasting`.
158158

159+
An in-place operation must have the same behavior (including special cases) as
160+
its respective binary (i.e., two operand, non-assignment) operation. For example,
161+
after in-place addition `x1 += x2`, the modified array `x1` must always equal the
162+
result of the equivalent binary arithmetic operation `x1 = x1 + x2`.
163+
159164
```{note}
160165
161166
In-place operators must be supported as discussed in {ref}`copyview-mutability`.

0 commit comments

Comments
 (0)