Skip to content

Commit d390877

Browse files
committed
✨: add CanArrayITruediv protocol
Support in-place true division operator for array classes
1 parent 5e07c4a commit d390877

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/array_api_typing/_array.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,22 @@ def __truediv__(self, other: Self | int | float, /) -> Self:
201201
...
202202

203203

204+
class CanArrayITruediv(Protocol):
205+
"""Protocol for array classes that support the in-place true division operator."""
206+
207+
def __itruediv__(self, other: Self | int | float, /) -> Self:
208+
"""Calculates the in-place quotient for each element of an array instance with the respective element of the array other.
209+
210+
Args:
211+
other: divisor array. Must be compatible with self (see Broadcasting). Should have a numeric data type.
212+
213+
Returns:
214+
self, after performing the in-place true division.
215+
216+
""" # noqa: E501
217+
...
218+
219+
204220
class CanArrayFloorDiv(Protocol):
205221
"""Protocol for array classes that support the floor division operator."""
206222

0 commit comments

Comments
 (0)