Skip to content

Commit eeaa9fa

Browse files
authored
feat!: return tuples rather than lists
PR-URL: #981 Closes: #938 Reviewed-by: Athan Reines <[email protected]> Reviewed-by: Evgeni Burovski
1 parent 6fd5129 commit eeaa9fa

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/array_api_stubs/_draft/creation_functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def linspace(
451451
"""
452452

453453

454-
def meshgrid(*arrays: array, indexing: Literal["xy", "ij"] = "xy") -> List[array]:
454+
def meshgrid(*arrays: array, indexing: Literal["xy", "ij"] = "xy") -> Tuple[array, ...]:
455455
"""
456456
Returns coordinate matrices from coordinate vectors.
457457
@@ -464,8 +464,8 @@ def meshgrid(*arrays: array, indexing: Literal["xy", "ij"] = "xy") -> List[array
464464
465465
Returns
466466
-------
467-
out: List[array]
468-
list of N arrays, where ``N`` is the number of provided one-dimensional input arrays. Each returned array must have rank ``N``. For ``N`` one-dimensional arrays having lengths ``Ni = len(xi)``,
467+
out: Tuple[array, ...]
468+
tuple of N arrays, where ``N`` is the number of provided one-dimensional input arrays. Each returned array must have rank ``N``. For ``N`` one-dimensional arrays having lengths ``Ni = len(xi)``,
469469
470470
- if matrix indexing ``ij``, then each returned array must have the shape ``(N1, N2, N3, ..., Nn)``.
471471
- if Cartesian indexing ``xy``, then each returned array must have shape ``(N2, N1, N3, ..., Nn)``.

src/array_api_stubs/_draft/info.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,19 @@ def dtypes(
174174
"""
175175

176176

177-
def devices() -> List[device]:
177+
def devices() -> Tuple[device, ...]:
178178
"""
179179
Returns a list of supported devices which are available at runtime.
180180
181181
Returns
182182
-------
183-
out: List[device]
184-
a list of supported devices.
183+
out: Tuple[device, ...]
184+
tuple containing a list of supported devices.
185185
186186
Notes
187187
-----
188188
189-
- Each device object (see :ref:`device-support`) in the list of returned devices **must** be an object which can be provided as a valid keyword-argument to array creation functions.
189+
- Each device object (see :ref:`device-support`) in the tuple of returned devices **must** be an object which can be provided as a valid keyword-argument to array creation functions.
190190
191191
Notes
192192
-----

src/array_api_stubs/_draft/manipulation_functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from ._types import List, Optional, Tuple, Union, array
2020

2121

22-
def broadcast_arrays(*arrays: array) -> List[array]:
22+
def broadcast_arrays(*arrays: array) -> Tuple[array, ...]:
2323
"""
2424
Broadcasts one or more arrays against one another.
2525
@@ -30,8 +30,8 @@ def broadcast_arrays(*arrays: array) -> List[array]:
3030
3131
Returns
3232
-------
33-
out: List[array]
34-
a list of broadcasted arrays. Each array **must** have the same shape. Each array **must** have the same dtype as its corresponding input array.
33+
out: Tuple[array, ...]
34+
tuple of broadcasted arrays. Each array **must** have the same shape. Each array **must** have the same dtype as its corresponding input array.
3535
"""
3636

3737

0 commit comments

Comments
 (0)