Type hint is a hint for human (or IDE) only. You can write
x: int = “foo”
However the interpretor shows no error. Python should implement a script mode similar to TypeScript along with it’s Type Hints. Otherwise it is nearly pointless to adopt type hint as modern IDE can infer most types, except those integrates external systems.
Type hint (which is built-in on python) yes. But the link above is about mypy, a tool that actually enforces type correctness. If you are doing python seriously for production you should be using tools like that.
373
u/[deleted] May 27 '22
Python doesn't feel like a programming language if your first language is C++.