Writing/Book
The Unbearable Lightness of Coding
Python was one of the first languages I learned – and then kept learning for years. Its elegance and versatility kept surprising me; from design patterns to language internals, it seemed the perfect medium for exploring software engineering at large.
This book grew out of ten years of teaching in industry and academia: a comprehensive, practical and occasionally philosophical overview of this wonderful language. Somewhat tragically, I finished it just as LLMs arrived, and with agents doing most of our coding, it lost some of its luster.
Still, I think there's value in learning to code – it certainly benefits me in my work with AI. It's less about syntax or libraries than a way of reasoning about problems, which still seems to me like the king's road to building good software.
As we reimagine our profession, I hope this guide helps those curious about how their ancestors used to type programs, slowly and manually – and the thinking that informed, and still informs, the paradigm shift we're living through.
Start readingContents
- 01 Preface
- 02 Assignment: Names, Values and Scopes
- 03 Conditions: If, Else and Boolean Fluency
- 04 Loops: While, For, and the Myth of Anti-Patterns
- 05 Functions 1: Signatures as Interfaces
- 06 Functions 2: Functional Programming
- 07 Functions 3: Code as an Object
- 08 Decorators: Mastering Function Objects
- 09 Generators: from Iterators to Coroutines
- 10 Objects 1: IDs, Types and Values
- 11 Objects 2: Inheritance
- 12 Objects 3: Mastering Magic Methods
- 13 Objects 4: Attributes, Methods and Descriptors
- 14 Objects 5: Lifecycle and Context Management
- 15 Metaclasses (and Are They Even Useful?)
- 16 Modules: from Dynamic Evaluation to Packages
- 17 Error Handling: Exceptions, Tracebacks and Frames
- 18 Native Types: Numbers, Strings and Containers
- 19 The Standard Library: Datetimes, Paths and Regular Expressions
- 20 The Walrus Operator: the Syntax and the Drama
- 21 The Match-Case Statement: So Much More than Switch
- 22 Type Hinting: The Dubiously Good, the Hypothetically Bad, and the Undeniably Ugly
- 23 Workflow: How to Write a Python Project
- 24 Performance: is Python Really that Slow?
- 25 Networking: How the Internet Works
- 26 Socket Programming: Clients, Servers and More
- 27 Concurrent Programming: Threads, Locks and the GIL
- 28 Async Programming: Select, Callbacks, and Coroutines
- 29 Web Development: How the Web Works
- 30 Web Programming: How to Write a Webserver
- 31 CLIs: an Underrated Interface, and Why You Should Use Click
- 32 GUIs: an Overrated Interface, and Why You Should Use Javascript
- 33 Design Patterns: the Gang of Four, and Whether We Still Need Them
- 34 Complexity: Where It Comes From, and Who Pays for It
- 35 Epilogue: The Unbearable Lightness of Coding