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

Remove usage of implicit Optional #171

Closed
sloria opened this issue Oct 8, 2020 · 0 comments · Fixed by #177
Closed

Remove usage of implicit Optional #171

sloria opened this issue Oct 8, 2020 · 0 comments · Fixed by #177

Comments

@sloria
Copy link
Owner

sloria commented Oct 8, 2020

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.

https://www.python.org/dev/peps/pep-0484/

We currently use implicit Optionals. mypy still allows them but may change this in the future.

sloria added a commit that referenced this issue Oct 31, 2020
sloria added a commit that referenced this issue Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant