3 ms·
From my understanding, size: float = None is syntactic sugar for size: Optional[float]
by delaaxe 5y ago
From my understanding,
size: float = None
is syntactic sugar for
size: Optional[float]
- nerdponx 5y agoIt's bitter, not sweet. I make sure "implicit None" is disabled in Mypy and I think everyone else should do the same.
- maleldil 5y agoMypy allows that because initial versions of PEP-484 allowed that. This has changed; here's the current wording on the PEP: > 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/#id29 https://www.python.org/dev/peps/pep-0484/#id29