Skip to content

Fix a typo in a type annotation #116

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

Merged
merged 5 commits into from
Jan 21, 2021
Merged

Fix a typo in a type annotation #116

merged 5 commits into from
Jan 21, 2021

Conversation

asmeurer
Copy link
Member

This also removes the dtype from the where() type annotation. We should document input and output dtypes (#98), but type annotations aren't the right place to do this.

Optional only takes one argument. It must be Optional[Union[...]] to be valid.
Since the default is an integer, None is not defined.
@asmeurer
Copy link
Member Author

I changed the annotation for the axis argument to stack from Optional[int] to just int, since the default is 0 rather than None. However, I'm not sure if this should be done, so I can revert it if we think the Optional is better. It's worth noting that np.stack(axis=None) gives an error.

endpoint=None is not defined, so it should not be Optional.
@asmeurer
Copy link
Member Author

I also changed the endpoint argument of linspace to be bool instead of Optional[bool]. Perhaps there was just some confusion about the difference between Optional[x], which is a shorthand for Union[x, None] (see https://docs.python.org/3/library/typing.html#typing.Optional), and keyword-only arguments with default values, which may be None or something else.

asmeurer added a commit to data-apis/numpy that referenced this pull request Jan 21, 2021
Copy link
Contributor

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Thanks for catching this!

@kgryte
Copy link
Contributor

kgryte commented Jan 21, 2021

Perhaps there was just some confusion about the difference between Optional[x].

No. Just a copy and paste error.

@kgryte kgryte merged commit aebcf68 into main Jan 21, 2021
@kgryte kgryte deleted the type-typo branch January 21, 2021 06:39
asmeurer added a commit to data-apis/array-api-tests that referenced this pull request Jan 21, 2021
leofang pushed a commit to leofang/cupy that referenced this pull request Sep 5, 2021
cr313 added a commit to cr313/test-array-api that referenced this pull request Apr 19, 2024
kgryte added a commit that referenced this pull request Dec 12, 2024
PR-URL: #868
Ref: #116
Co-authored-by: Athan Reines <kgryte@gmail.com>
Reviewed-by: Athan Reines <kgryte@gmail.com> 
Reviewed-by: Ralf Gommers <ralf.gommers@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants