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: ...
|
lovelydinosaur
left a comment
There was a problem hiding this comment.
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