We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@overload def f1(o: NoneType) -> str: return 'None' @overload def f1(o: int) -> str: return type(o).__name__ @overload def f1(o: str) -> str: return type(o).__name__ print(f1('')) print(f1(0)) print(f1(None))
Will fail with optional is None. I've found workaround:
optional is None
@overload def f1(o: Optional[NoneType]=None) -> str: return 'None' @overload def f1(o: Optional[int]) -> str: if o is None: return f1() return type(o).__name__ @overload def f1(o: Optional[str]) -> str: if o is None: return f1() return type(o).__name__ print(f1('')) print(f1(0)) print(f1(None)) print(f1())
This works, but this is awful. Especially awful is need to add if o is None to every variant (calls lexically last variant). Any hints?
if o is None
The text was updated successfully, but these errors were encountered:
inumanag
No branches or pull requests
Will fail with
optional is None
. I've found workaround:This works, but this is awful. Especially awful is need to add
if o is None
to every variant (calls lexically last variant).Any hints?
The text was updated successfully, but these errors were encountered: