Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From my understanding,

    size: float = None
is syntactic sugar for

    size: Optional[float]


Mypy 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


It's bitter, not sweet. I make sure "implicit None" is disabled in Mypy and I think everyone else should do the same.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: