Leveraging typing.Protocol: Faster Error Detection And Beyond Inheritance

Introduction Two weeks ago I wrote an article about ABCs and interface enforcement. Shortly after I learned that you can do this as well with protocols. Python 3.8 introduced quite a groundbreaking feature that further advanced the language’s capabilities in type checking: the typing.Protocol which allows Python developers to define and enforce interface contracts in… Continue reading Leveraging typing.Protocol: Faster Error Detection And Beyond Inheritance

How to Send Email Notifications Using Sendgrid and GitHub Actions

Introduction As a Python developer I want to stay up2date with trends and useful tips & tricks. Of course there are great newsletters like Pycoders, but those are already hitting my inbox. Let’s look at Planet Python in this article, an aggregation site/ service that indexes a lot of good Python blog feeds. Keeping an… Continue reading How to Send Email Notifications Using Sendgrid and GitHub Actions

Elevate Your Python: Harnessing the Power of Abstract Base Classes (ABCs)

Introduction One cool object-oriented programming (OOP) technique / pattern is enforcing consistent interfaces. In Python you can use Abstract Base Classes (ABCs) for that. 🐍 Using ABCs ensures that all subclasses implement the required methods. This can make it easier to maintain and extend the existing code base. Update Feb 2024: you can also leverage… Continue reading Elevate Your Python: Harnessing the Power of Abstract Base Classes (ABCs)

Exploring the Role of Static Methods in Python: A Functional Perspective

Introduction Python’s versatility in supporting different programming paradigms, including procedural, object-oriented, and functional programming, opens up a rich landscape for software design and development. Among these paradigms, the use of static methods in Python, particularly in an object-oriented context, has been a topic of debate. This article delves into the role and implications of static… Continue reading Exploring the Role of Static Methods in Python: A Functional Perspective

6 Cool Things You Can Do With The Functools Module

In this article let’s look at the functools Standard Library module and 6 cool things you can do with it (be warned, a lot of decorators are coming your way! 😍) … 1. Cache (“memoize”) things You can use the @cache decorator (formerly called @lru_cache) as a “simple lightweight unbounded function cache”. The classic example is… Continue reading 6 Cool Things You Can Do With The Functools Module

Your First Python Open Source Contribution: A Step-By-Step Guide

Introduction I recently re-engaged with one of my open source projects and it was a rewarding experience. 🎉 It was a Pybites project I had written the core for years ago, but thanks to some amazing Pythonistas in our community it became a way more mature tool so I had to get acquainted again. I… Continue reading Your First Python Open Source Contribution: A Step-By-Step Guide

Make Each Line Count, Keeping Things Simple in Python

A challenge in software development is to keep things simple 🤯 For your code to not grow overly complex over time 😱 Simple is better than complex.Complex is better than complicated. Zen of Python 🐍 Simplicity in your code means fewer possibilities for bugs to hide and easier debugging when they do arise 📈 It… Continue reading Make Each Line Count, Keeping Things Simple in Python

⚠️Why you should avoid import * in Python 🐍

Anyone who’s worked with Python knows that modules can be a Godsend, saving you time, effort, and many lines of code. They even have namespacing built-in 💪 😍 To expand on this a bit: However, not all ways of using modules are equally beneficial. In this article, we will discuss why using import * can… Continue reading ⚠️Why you should avoid import * in Python 🐍

The Arbitrary (Keyword) Arguments (args and kwargs) don’t come “for free” in Python

Python allows you to use *args and **kwargs in function definitions to accept an arbitrary number of positional and keyword arguments, respectively. Here is a simple example: Different types of function arguments In the above example, the arbitrary_args function is defined to accept any number of positional and keyword arguments using the *args and **kwargs… Continue reading The Arbitrary (Keyword) Arguments (args and kwargs) don’t come “for free” in Python