What Does "Pythonic" Code Really Mean? | Issue #78


Hi there,

You’ve probably heard developers say "That’s not very Pythonic…"

But what is Pythonic code, really?

Is it about using list comprehensions? Avoiding for-loops? Dressing up like Guido van Rossum?

In this week’s video, I answer that question by taking a small, messy Python script and refactoring it step-by-step using the principles behind idiomatic Python. Along the way, I’ll show you what it means to think like a Python developer, using things like:

  • Functions instead of unnecessary classes
  • Dataclasses for structured data
  • Context managers and type hints
  • Python’s built-in logging system
  • And of course, the Zen of Python 🧘‍♂️

By the end, you’ll have a much clearer understanding of what Pythonic code looks like and why it’s worth aiming for.


Enjoy the video and have a great weekend!

Cheers,

Arjan


Do you enjoy my content on YouTube and would you like to dive in deeper?

🚀 Check out my online courses

My courses have helped thousands of developers take the next step in their careers. Check out these courses to help grow your skills and become a senior developer:

👕 Clean code and clean clothes

The ArjanCodes merch store features T-shirts, hoodies, hats, and more for the clean-code-obsessed. Careful though: you'll look dangerously professional while reviewing PRs.

👉 Check out the store here and grab something before your stand-up call starts.

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

You’ve tested the endpoint. The response looks right. No errors in the terminal. So you’re done, right? Well... not quite. In the last video of this year (time flies!) I start with a tiny FastAPI app that "works", and step by step, I turn it into something that’s actually ready for production (and that's more work than you think). That includes: Proper type usage Input validation and error handling Configuration management Rate limiting to prevent abuse ...and more! All using a real example:...

Sometimes your code fails, you change absolutely nothing, and on the next run everything works again. If that sounds familiar, this week’s video is for you. These kinds of failures usually have nothing to do with bad code. They come from the outside world: APIs that time out, networks that briefly misbehave, or LLMs that occasionally return something almost structured, but not quite. It’s frustrating, because the failure feels random, and those types of failures are really annoying to debug!...

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