Mutable Default Arguments: Python's Favorite Gotcha

Every Python developer eventually writes a function like this, watches it misbehave in a way that makes no sense, and joins the club: def add_item(item, basket=[]): basket.append(item) return basket print(add_item("apple")) # ['apple'] print(add_item("banana")) # ['apple', 'banana'] <- wait, what? You expected ['banana']. Instead the second call remembers the first one. Nothing about the code looks wrong at a glance, which is exactly why this bites so many people, including plenty who’ve been writing Python for years. I’ve shipped this bug myself, in a function that collected validation errors, and didn’t notice until a support ticket showed one request’s errors leaking into an unrelated request. ...

August 27, 2026 · 5 min

Python Logging Done Right

I have never once, in production, wished I had more print() statements to grep through. What I have wished for, repeatedly, at 2am, is a log line that included a request ID, a timestamp in a sane timezone, and a severity level I could filter on. The standard library’s logging module gives you all of that for free. Most people just don’t use it that way, they call logging.info("here") a few times, never touch the configuration, and end up with something barely better than print. This article is about the difference between using logging and using it well. ...

August 25, 2026 · 10 min

Python Type Hints in Practice

Python’s type hints are optional, unenforced at runtime, and yet they’ve become one of the most consequential additions to the language since async/await. They don’t make Python statically typed. What they do is give you a shared vocabulary for describing shapes of data, a way to catch entire categories of bugs before your tests do, and editor support that turns “let me go check the implementation” into a tooltip. This article covers the parts of the typing ecosystem you’ll actually reach for, the ones you’ll see in real codebases, and the tools that turn hints from documentation into enforcement. ...

July 27, 2026 · 10 min

The Most Underrated Packages in the Python Standard Library

Every Python developer knows os, json, and collections. Far fewer reach for bisect when they need a sorted insert, or graphlib when they need a dependency order, and end up pulling in a third-party package (or writing worse code by hand) for something the standard library already does well. This is a tour of the modules that don’t get enough credit: what they do, and how they show up in real code. ...

July 24, 2026 · 7 min