MonkeyType
MonkeyType copied to clipboard
Support PEP 604 Union syntax (Union[a, b] → a | b)
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:
...
Yes, this would be awesome!
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.