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
Bug Report
Quoted from PEP 484:
A past version of this PEP allowed type checkers to assume an optional type when the default value is None, as in this code: def handle_employee(e: Employee = None): ... This would have been treated as equivalent to: def handle_employee(e: Optional[Employee] = None) -> None: ... This is no longer the recommended behavior. Type checkers should move towards requiring the optional type to be made explicit.
A past version of this PEP allowed type checkers to assume an optional type when the default value is None, as in this code:
def handle_employee(e: Employee = None): ...
This would have been treated as equivalent to:
def handle_employee(e: Optional[Employee] = None) -> None: ...
This is no longer the recommended behavior. Type checkers should move towards requiring the optional type to be made explicit.
To Reproduce
mypy handle_employee.py
Expected Behavior
mypy show a warning or an error like this:
error: Incompatible default for argument "e" (default has type "None", argument has type "Employee")
Actual Behavior
No warning or error is given.
Your Environment
mypy.ini
The text was updated successfully, but these errors were encountered:
Duplicate of #9091
Sorry, something went wrong.
No branches or pull requests
Bug Report
Quoted from PEP 484:
To Reproduce
mypy handle_employee.py
Expected Behavior
mypy show a warning or an error like this:
Actual Behavior
No warning or error is given.
Your Environment
mypy.ini
(and other config files): I don't set it.The text was updated successfully, but these errors were encountered: