The Philosophical Developer — Chapter 09: Language Transfer

2026-07-03 · 3 min read

tqdm

I moved my padawan from Go to Python for Chapter 09. I wanted to know if the methodology transfers. The same four phases: reconnaissance, work item, RED test, fix. Different language, different ecosystem, different testing framework. The question was not whether it works for Go. The question was whether it works in general.

The codebase was tqdm, a progress bar library that has been installed over 200 million times. Nine thousand lines of Python spread across a well-organised package. Tests using pytest. Issues managed with labels. A mature project with a clear architecture.

We picked three bugs from the real issue tracker. The first was seven years old. The second was five and labelled critical. The third was four years old and had sixteen reactions.

Bug 1: Terminal resize ghosting (7 years old)

A visual bug in the terminal output. When you resize your terminal to a narrower width while tqdm is running, the progress bar leaves ghost characters on screen. Parts of the previous wider bar remain visible, like a double exposure on film.

The status printer used carriage return and space padding to overwrite previous output, but this only works when the bar occupies a single physical line. When the terminal shrinks, the previously printed bar wraps across multiple lines. The carriage return lands on the last line, not the first. The padding only covers the last row. Characters on the rows above stay visible.

My padawan traced the code path from status printer through display to format meter in about ten minutes. The spike confirmed the analysis. The fix was ten lines in the display method: track the last terminal width used, and when it shrinks, emit a clear-to-end-of-screen sequence before redrawing.

Bug 2: The honest dead end (5 years, labelled critical)

A multiprocessing freeze. The bar would freeze near completion when used with Pool.apply_async callbacks.

My padawan wrote the spike script with the exact pattern from the issue. It worked perfectly. He tried variations. Every one worked. The reporter himself had said “I am struggling to reproduce the problem.” The maintainer had tried and failed.

We documented it honestly and moved on. Not every bug is reproducible. The process is honest even when it produces a dead end.

Bug 3: The one-line fix (4 years, 16 reactions)

The logging integration helper, logging_redirect_tqdm, replaces console logging handlers with tqdm-aware wrappers. It copied the formatter. It copied the stream. It forgot to copy the log level.

If your root logger was set to DEBUG but your console handler was set to INFO, the tqdm wrapper leaked DEBUG messages to the console. Sixteen people had reacted to the issue. No one had submitted the one-line pull request.

My padawan added the missing line, wrote the test, and moved on.

What it means

The three bugs together tell a better story than any two. The first proves the process works. The second proves the process is honest. The third proves that even the simplest fixes can sit open for years when no one follows a systematic process.

The methodology transferred cleanly from Go to Python. The same reconnaissance phase that traced interface implementations in afero traced the status printer chain in tqdm. The same RED test discipline caught the escaping edge cases.

Languages change. Ecosystems change. Discipline stays.

Repos: