Readable code in practice

A Code Review Checklist for Python Projects

Readable code in practice · · Published 2026-10-27

Students in a late nineteenth-century printing shop standing at slanted type cases, setting type by hand
Students at work in the printing shop of the Hampton Institute, Virginia, photographed by Frances Benjamin Johnston. Library of Congress, public domain.

Code review is where a team's conventions are actually applied, and where most of them are learned. It works best when machines handle everything mechanical and people spend their attention on what only people can judge. This checklist is organised in that order.

Step 0: automate the mechanical part

A review comment about whitespace or import order is time wasted on both sides, and it makes reviews feel petty. Settle those questions with tools before a human looks at the change:

If a project does not have these yet, introducing them is itself a worthwhile change; our guide to adopting a style guide in an existing codebase describes how to do it without disrupting everyone. For a quick check of a snippet you are about to paste into a review comment, the checker on our home page runs a subset of pycodestyle's checks in the browser.

The reviewer's checklist

Go roughly in this order: there is no point polishing names in code that does the wrong thing.

1. Purpose and behaviour

2. Tests

3. Design and structure

4. Names and readability

5. Errors and resources

The programming recommendations of PEP 8 cover several of these points with examples.

6. Security and data

7. Performance, where it matters

8. Compatibility and documentation

Writing review comments

Approving is a statement too. Python's developer guide asks reviewers not to simply approve, but to say what they checked: that they reproduced the issue, ran the tests or tried the change.

The author's side

  1. Keep changes small. A focused pull request gets a careful review; a huge one gets a skim.
  2. Explain the intent in the description: what, why, how it was tested, what to look at first.
  3. Review your own diff first. Debug prints, commented-out code and unrelated reformatting are easy to spot before anyone else does.
  4. Separate refactoring from behaviour changes, ideally in different commits or pull requests.
  5. Answer every comment, with a change or a reason, and do not take suggestions personally.

Reviewing in a new team

Reading other people's pull requests is the fastest way to learn a codebase's unwritten conventions, which makes reviewing a good habit from your first week in a new job. If that job also came with a move, our checklist for your first months after relocating covers the rest of the transition. For the code itself, the guide to readable Python code develops the questions in section 4.

Sources