Skip to content
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

MAINT: Remove usage of the PEP 604 pipe operator #18985

Merged
merged 1 commit into from
May 11, 2021
Merged

Conversation

BvB93
Copy link
Member

@BvB93 BvB93 commented May 10, 2021

Remove the PEP 604 pipe operator and replace it with typing.Union.

The pipe operator is currently not yet universally supported by all type checkers (see python/typeshed#4819).
While we don't necessarily have to wait for all type checkers to support it, I feel that delaying its usage to numpy 1.22
would still be a reasonable compromise.

Examples

from __future__ import annotations

# Equivalent to `def func(a: Union[int, float]) -> bool: ...`
def func(a: int | float) -> bool: ...   

@BvB93 BvB93 added this to the 1.21.0 release milestone May 10, 2021
@BvB93 BvB93 changed the title MAINT: Remove the PEP 604 pipe operator MAINT: Remove usage of the PEP 604 pipe operator May 10, 2021
@charris charris merged commit 938fe1f into numpy:main May 11, 2021
@charris
Copy link
Member

charris commented May 11, 2021

Thanks Bas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants