shlogg · Early preview
Gabor Szabo @szabgab

Python Type Annotations: A Safety Net For Your Code Base

Python's flexible typing can be both a blessing and a curse. Type annotations are added for clarity, but Python ignores them. External tools like mypy check adherence to these rules, making code safer & easier to maintain.

Python is one of the most flexible languages out there. For example you can easily use the same variable, to store first a number then assign a string to and later even a list of booleans. Python will accept whatever you put in the variable.
This is great but people who arrived to Python from strongly typed languages where you had to declare each variable with its type felt very uncomfortable with all that flexibility. They felt the compiler does not protect them.
So the Python community came up with some type-annotation that you can add to your code. 🎁
The problem is that Python actually dis...