3 ms·
It's not only optional, it does nothing by default. What was introduced into python is a standardized way to do type annotations. It consists mostly of a new st
by catdog 10y ago
It's not only optional, it does nothing by default. What was introduced into python is a standardized way to do type annotations. It consists mostly of a new standard library module and as far as i know it doesn't even introduce changes to the language as it uses comments, additional files and the rarely used function annotations. The interpreter happily ignores them anyways but external tools like mypy don't have to invent their own incompatible syntax.
- twblalock 10y agoI was more excited about them when I believed they were actually enforced. I guess they help with static analysis in IDEs, but you can still get type errors at runtime, so Python is still missing out on the main advantage of static typing.
- hendzen 10y agothere is a type checker available: http://mypy-lang.org/ http://mypy-lang.org/
- viraptor 10y ago> as far as i know it doesn't even introduce changes to the language as it uses comments That's not the case. See for example https://www.python.org/dev/peps/pep-0484/#type-definition-syntax https://www.python.org/dev/peps/pep-0484/#type-definition-sy...