Typing
-
A guide to type checking in python
Oct 04, 2024
15 minutes
3036 words
#programming
#python
#typing
Python is often known for its dynamic typing, which can be a drawback for those who prefer static typing due to its benefits in catching bugs early and enhancing editor support. However, what many people don’t know is that Python does actually support specifying the types and it is even possible to enforce these types and work in a statically type-checked Python environment.…
-
Type variables in python typing
Oct 04, 2024
7 minutes
1318 words
#programming
#python
#typing
Python’s type hinting system offers great flexibility, and a crucial part of that flexibility comes from Type Variables. These allow us to define generic types, enabling us to write functions and classes that work with different types while maintaining type safety.…
-
Typing generics and variance
Oct 04, 2021
18 minutes
3703 words
#programming
#python
#typing
Generics and variance are advanced concepts in Python’s type system that offer powerful ways to write code that is flexible and reusable across different types. By understanding these concepts, you can write more robust, maintainable and less repetitive code, making the most of Python’s type hinting capabilities.…