Skip to content

Commit c32a452

Browse files
committed
Add docstring to __array_namespace__
1 parent 78d368d commit c32a452

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

array_api_strict/_array_object.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,20 @@ def __and__(self: Array, other: Union[int, bool, Array], /) -> Array:
487487
def __array_namespace__(
488488
self: Array, /, *, api_version: Optional[str] = None
489489
) -> types.ModuleType:
490+
"""
491+
Return the array_api_strict namespace corresponding to api_version.
492+
493+
The default API version is '2022.12'. Note that '2021.12' is supported,
494+
but currently identical to '2022.12'.
495+
496+
For array_api_strict, calling this function with api_version will set
497+
the API version for the array_api_strict module globally. This can
498+
also be achieved with the
499+
{func}`array_api_strict.set_array_api_strict_flags` function. If you
500+
want some way to only set the version locally, use the
501+
{class}`array_api_strict.ArrayApiStrictFlags` context manager.
502+
503+
"""
490504
if api_version is not None and api_version not in ["2021.12", "2022.12"]:
491505
raise ValueError(f"Unrecognized array API version: {api_version!r}")
492506
if api_version == "2021.12":

0 commit comments

Comments
 (0)