Skip to content

docs: default_device() can be None #961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/array_api_stubs/_draft/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def default_device() -> device:
Returns
-------
out: device
an object corresponding to the default device.
an object corresponding to the default device or ``None``.
A conforming array library may return ``None`` if the default device is not
predictable due to library specific device placement rules.
Comment on lines +83 to +85
Copy link
Member

@betatim betatim Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
an object corresponding to the default device or ``None``.
A conforming array library may return ``None`` if the default device is not
predictable due to library specific device placement rules.
an object (including ``None``) corresponding to the default device or ``None``.

I'd formulate it like this - because if we were to be super pedantic we wouldn't need to mention None at all as it is an object. I find this a nice way to say "all objects, including None (which you might have forgotten about), are allowed.

I don't think the docstring of the return value needs to hypothesis about when a library might want to use which value. If we want to get into that I think the Notes or Examples section would be better suited


Notes
-----
Expand Down