3 ms·
https://docs.python.org/3/library/typing.html https://docs.python.org/3/library/typing.html
by occams_chainsaw 9y ago
https://docs.python.org/3/library/typing.html https://docs.python.org/3/library/typing.html
- KMag 9y agoThose are type hints, not type inference. Mypy provides some static type checking and inference, aided by those annotations, but mypy is an external tool. I understand the comment about type inference allowing less typing. However, I don't understand the OP's statement that type inference provides more flexibility. Any program that type checks under type inference will also type check if the inferred types are made explicit via annotations, so I'm not sure what the OP means by inference providing flexibility, unless they just mean trivial flexibility of surface syntax. I think the OP may be conflating type inference and gradual/optional typing, but it's hard to be sure from such terse comments.