Write elegant Python code

A series of articles that teaches you how to make the best use of the core Python features. The Pydon'ts are available as an e-book that you can read for free below.


for loops are the bread and butter of imperative programming and Python has some really nice tools to work with them. If you want to traverse several structures in parallel, have you considered using zip?

Structural pattern matching is coming in Python 3.10 and the previous Pydon't explored some interesting use cases for the new match statement. This article explores situations for which match isn't the answer.

Structural pattern matching is coming in Python 3.10 and this article explores how to use it to write Pythonic code, showing the best use cases for the match statement.

Python's comparisons operators can be chained to shorten common comparison expressions. Learn the ins and outs of comparison operator chaining and especially the cases you should avoid, namely those where you chain comparison operators that aren't aligned.