-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
use explicit Optional[...] for parameters with None as a default in datastructures.py #1448
Conversation
The link is "not found". |
Weird, it got mangled, it should be https://www.python.org/dev/peps/pep-0484/#union-types |
Specifically:
def handle_employee(e: Employee = None): ...
def handle_employee(e: Optional[Employee] = None) -> None: ...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Don't know what the motivation is behind...
This is no longer the recommended behavior. Type checkers should move towards requiring the optional type to be made explicit.
But happy enough either ways. 😌
There's probably discussions on the topic in BPO and such. Personally my motivation is just to make sure the project works as well as possible with type checkers. |
See https://www.python.org/dev/peps/pep-0484/#union-types