Python Decorators Considered Harmful | Issue #50


Hi there,

If you’ve ever used Python decorators, you know they look like a clean way to add functionality. But have you ever struggled to debug a decorated function? Or wondered why your type hints suddenly break? Or spent way too much time figuring out why your decorators aren’t working as expected? 🫠 🚨

Decorators introduce hidden complexity that can turn your code into a nightmare. And honestly? I think they’re overused. In this week’s video, I explain:

  • Why decorators break type safety and make debugging harder
  • How the wrong order of decorators can silently break your app
  • Why some decorators expect hidden arguments (and how that messes up your code)
  • The few cases where decorators actually make sense

If you want to write better, cleaner Python, this video is a must-watch. 🚀

Happy coding! 🐍

Cheers,

Arjan

# News

Meet DuckDB: The Sqlite of Analytics… but Actually Fast 🦆

Still wrestling with CSVs in pandas or stuffing everything into PostgreSQL just to get some analysis done? It might be time to level up your data workflow. 🚀

Meet DuckDB —a lightweight, blazing-fast analytical database that plays beautifully with Python, and runs in-process. That means: no server, no setup headaches, just smooth data magic. ✨

Real Python 🐍 recently published a great article breaking it all down. And if you prefer a more interactive deep dive, I made a video explaining why DuckDB is a total game-changer for Python devs and data enthusiasts alike. 🎥 You can watch it here!

🧵 Writing Async-Aware Decorators in Python

Ever tried decorating an async function and hit a wall? Tanner Young’s post is a goldmine for Python devs who want to write decorators that just work—whether the target function is synchronous or asynchronous.

He covers:

  • How to detect if a function is async
  • Why await can’t be used blindly in decorators
  • A clean pattern to support both sync + async functions

A must-read for Python devs looking to level up their async game. 👉 Check it out here.

# Community

In the #project_showcase channel, community member razorblade23 shared an exciting new tool: PyCrucible — a cross-platform builder and launcher for Python apps using Rust and uv.

It packages your app into a single executable that self-extracts, installs dependencies, and just runs. No setup required. 🛠

The project is in its early alpha phase and evolving fast, with thoughtful feedback already coming in from folks like James Parrott.

👉 Curious? Want to help shape it? Join the conversation in Discord and share your thoughts, suggestions, or test results. 💬


Do you enjoy my content on YouTube and would you like to dive in deeper? Check out my online courses below. They've helped thousands of developers take the next step in their careers.

🚀 The Mindset Online Course Series

The goal of this series is to help junior developers grow their skills to become senior developers faster.

💥 Other Courses

💡 If you’re part of a development team at a company, I offer special packages for companies that give your team the tools to consistently write high-quality code and dramatically increase your team's productivity.

Unsubscribe | Send by ArjanCodes

Wolvenplein 25, Utrecht, UT 3512 CK

The Friday Loop

Every Friday, you'll get a recap of the most important and exciting Python and coding news. The Friday Loop also keeps everyone posted on new ArjanCodes courses and any limited offers coming up.

Read more from The Friday Loop

If you’ve ever opened a function and instantly regretted it… this week’s video is for you. I’m talking about those legendary functions: ten levels of indentation, contradictory conditions, duplicate branches, mysterious try/except blocks, and business logic so unclear that nobody knows what it actually does anymore. I start with a really messy example and walk through the exact process I use to refactor it safely. You’ll see how to create characterization tests so you don’t break existing...

Have you ever written a Python script that felt slow, even though the logic was simple? Sometimes it’s not the efficiency of your code that's the problem, it’s when your code does its work. This week’s video is all about the Lazy Loading design pattern, and I think many developers underestimate how powerful (and practical) it is. I start with a real example: loading a huge CSV file that freezes your program for 10 seconds before doing anything useful. Then, step by step, we improve it using:...

If your code is hard to test, hard to reuse, and hard to change, you’re probably hardcoding your dependencies. It’s one of the most common architectural problems I see in Python code, even in production systems. In this week's video, I take a small but realistic example, a data pipeline that loads, transforms, and exports some records, and show you how Dependency Injection can turn it from a rigid mess into something clean, testable, and modular. No frameworks required. You’ll learn: Why...