Python

  • 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.…

  • Concurrency and Parallelism Nov 17, 2021 18 minutes 3706 words #programming #python

    Concurrency is an exciting topic that’s becoming more and more important, yet I see so many people that aren’t very familiar with topic and it’s possibilities. I’ll try to explain the differences between threading, multiprocessing and asynchronous run. I’ll also show some examples when concurrency should be avoided, and when it makes sense.…

  • Removing duplicates from lists Aug 31, 2021 11 minutes 2266 words #programming #python

    In programming, we often need to handle removing duplicates from an array-like structure. While this may seem like an arbitrary and easy question, that can be solved relatively simply, that’s not necessarily always the case. While it may be easy to solve for the obvious case of things like a list of numbers, it’s not so easy if we need to deal with non-hashable objects, while keeping the algorithm runtime relatively low.…

  • 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.…