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

Avoiding Silent Failures in Python: Best Practices for Error Handling

In the world of programming, errors are inevitable. But how we choose to handle these errors can make the difference between a system that is robust and user-friendly and one that is fraught with ambiguous issues ๐Ÿ˜ฑ The Zen of Python famously states, “Errors should never pass silently.” This principle emphasizes the importance of addressing… Continue reading Avoiding Silent Failures in Python: Best Practices for Error Handling

How to better streamline your Python project using a Makefile

Makefiles are awesome, and you can use them in your Python projects too (they are not only to compile and build C/C++ projects that is) ๐Ÿ˜Ž They help you automate various tasks and streamline the development process overall ๐Ÿš€ They allow you to: – Manage dependencies– Run tests– Build documentation– Format your code– Lint and… Continue reading How to better streamline your Python project using a Makefile

5 tips to learn any new Python library faster

This was a Pybites email first. To always get the latest and greatest content, subscribe here. Lately I have been learning some new libraries for weekly PDM Code Clinic demo sessions (e.g. PyScript, Flet, PySimpleGUI, Playwright, htmx, Redis, Leaflet, etc.) There is a general approach I take that makes this less painful and more fun.… Continue reading 5 tips to learn any new Python library faster