-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
enhancement requestNew feature or requestNew feature or request
Description
I read through #2806
Is there possibility of adding an opt in feature of type checking against overload signatures?
For default values, for example
@overload
def f() -> str: ...
@overload
def f(a: int) -> int: ...
@overload
def f(a: str) -> str: ...
def f(a: int | str | None = None) -> int | str:
if a is None:
return "None"
return athis def f() -> str: would be type checked the same as
def f() -> str:
a = None
if a is None:
return "None"
return aI know there are cases where this behavior doesn't work, but if this feature exists, I would just happily enable it and prohibit implementation that doesn't align with it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancement requestNew feature or requestNew feature or request