Skip to content

Commit 95c098b

Browse files
committed
refactor: limit to integer data types
1 parent 1c78599 commit 95c098b

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/array_api_stubs/_draft/set_functions.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55

66

77
def isin(
8-
x1: Union[array, int, float, complex, bool],
9-
x2: Union[array, int, float, complex, bool],
8+
x1: Union[array, int],
9+
x2: Union[array, int],
1010
/,
1111
*,
1212
invert: bool = False,
1313
) -> array:
1414
"""
15-
Tests whether each element in ``x1`` is in ``x2``.
15+
Tests for each element in ``x1`` whether the element is in ``x2``.
1616
1717
Parameters
1818
----------
19-
x1: Union[array, int, float, complex, bool]
20-
first input array. **May** have any data type.
21-
x2: Union[array, int, float, complex, bool]
22-
second input array. **May** have any data type.
19+
x1: Union[array, int]
20+
first input array. **Should** have an integer data type.
21+
x2: Union[array, int]
22+
second input array. **Should** have an integer data type.
2323
invert: bool
2424
boolean indicating whether to invert the test criterion. If ``True``, the function **must** test whether each element in ``x1`` is *not* in ``x2``. If ``False``, the function **must** test whether each element in ``x1`` is in ``x2``. Default: ``False``.
2525
@@ -32,17 +32,8 @@ def isin(
3232
-----
3333
3434
- At least one of ``x1`` or ``x2`` **must** be an array.
35-
3635
- If an element in ``x1`` is in ``x2``, the corresponding element in the output array **must** be ``True``; otherwise, the corresponding element in the output array **must** be ``False``.
37-
38-
- Testing whether an element in ``x1`` corresponds to an element in ``x2`` **must** be determined based on value equality (see :func:`~array_api.equal`). For input arrays having floating-point data types, value-based equality implies the following behavior. When ``invert`` is ``False``,
39-
40-
- As ``nan`` values compare as ``False``, if an element in ``x1`` is ``nan``, the corresponding element in the returned array **must** be ``False``.
41-
- As complex floating-point values having at least one ``nan`` component compare as ``False``, if an element in ``x1`` is a complex floating-point value having one or more ``nan`` components, the corresponding element in the returned array **must** be ``False``.
42-
- As ``-0`` and ``+0`` compare as ``True``, if an element in ``x1`` is ``±0`` and ``x2`` contains at least one element which is ``±0``, the corresponding element in the returned array **must** be ``True``.
43-
44-
When ``invert`` is ``True``, the returned array **must** contain the same results as if the operation is implemented as ``logical_not(isin(x1, x2))``.
45-
36+
- Testing whether an element in ``x1`` corresponds to an element in ``x2`` **must** be determined based on value equality (see :func:`~array_api.equal`).
4637
- Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is unspecified and thus implementation-defined.
4738
"""
4839

0 commit comments

Comments
 (0)