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

Support PEP 604 Union syntax (Union[a, b] → a | b) #270

Open
AllanLeanderRostockHansen opened this issue Jun 21, 2022 · 2 comments
Open

Comments

@AllanLeanderRostockHansen

PEP 604 introduces a new Union syntax in Python 3.10+. It would be nice if Monkeytype could leverage that, and perhaps have a flag to use a union with None rather than the Optional type.

# Old syntax
def foo(a: Optional[Union[float, int]]) -> Optional[float]:
    ...

# New syntax
def foo(a: float | int | None) -> float | None:
    ...
@EwoutH
Copy link

EwoutH commented Mar 20, 2023

Yes, this would be awesome!

@carljm
Copy link
Contributor

carljm commented Mar 20, 2023

Agreed, this would be a nice improvement. MonkeyType is currently in maintenance mode; I'd be happy to review a contributed PR for this, but it's not likely to happen otherwise.

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

No branches or pull requests

3 participants