Let’s talk about abstractions and Pythonic code.
So far, I’ve held it at Python Web Conf 2020 and Python Conference 2021 in the Zoo of Amersfoort / Netherlands.
- Primitive Obsession
- Overcoming Primitive Obsession uses Ruby but the same principles apply.
- Premature Optimization
- Donald Knuth is never shy of a pithy quote.
- Fixing Unix/Linux/POSIX Filenames: Control Characters (such as Newline), Leading Dashes, and Other Problems 30,000 words on UNIX filenames.
- pathlib
- ipaddress
- yarl is my favorite URL library.
- hyperlink is cool too and comes from the Twisted ecosystem.
- JSON:API a specification for building APIs in JSON.
- Flask for Fun and Profit by Armin Ronacher.
- voluptuous, despite its name, remains my favorite data validation package for Python.
- Finite-state machines are an abstraction that allows to declare states, valid inputs, and transitions based on them. They usually replace huge and brittle if-then-else trees.
- Automat is a production-ready implementation of that concept.
- Simple Made Easy by the creator of Clojure. A seminal talk on the difference between simple and easy solutions.
- decimal is a decent type for money.
- How to pronounce “__”? (2002)
- Stop Writing Classes
- Start Writing More Classes
- Stop writing stupid classes. (aka The controller pattern is awful (and other OO heresy))
- 99 Bottles of OOP is my favorite book on class design, albeit it uses Ruby.
- Everything by Sandi Metz is great for that matter (scroll down for her talks).
- Architecture Patterns with Python, the most important Python book of the past years. You should read it.
- I have written many words on subclassing that is relevant: Subclassing in Python Redux. Brew yourself a hot beverage and enjoy the ride!
- characteristic was my first terrible attempt at writing a class creator – for historical interest only.
- attrs
- dataclasses
Credits
- Turnstile FSM adapted from Wikipedia
- Turnstile photo