B is for batteries included - Python A to Z
Code in this blog post was written with versions: Python: 3.14
Python A-Z is a blog series about Python. Each day, I share insights, ideas and examples for different parts of Python development that match with the letter of the day. Blaugust is an annual blogging festival in August where the goal is to write a blog post every day of the month.
Python is often described as having batteries included
The Python source distribution has long maintained the philosophy of “batteries included” – having a rich and versatile standard library which is immediately available, without making the user download separate packages. This gives the Python language a head start in many projects. - from withdrawn PEP 206
I love Python’s batteries included philosophy and its standard library so much that I dedicated an entire Blaugust in 2024 writing about it:
- Parsing nginx server logs with regular expressions
- Reading and writing CSV with Python
- Improve your code with namedtuples
- Count ‘em
- help() me Obi-Wan Kenobi, you’re my only hope
- Improved print readability with pprint
- Document intended usage through tests with doctest
- Debug with pdb and breakpoint
- Rotating turn order with deque
- Data classes in Python with dataclasses
- Combinatoric iterators from itertools
- Write more pythonic code with context managers
- Random number chosen by fair dice roll
- Combine iterables with zip
- map and filter with list comprehensions
- Memoize with functools.cache
- Keep track of happenings with logging
- Bring your custom toolkit to REPL sessions
- Serve local HTML and CSS files with http.server
- Branch out with pattern matching
- Test your codebase with unittest
- Pretty print and validate JSON on command line with json.tool
- Parse command line arguments with argparse
- Quick prototyping with sqlite3
At PyCon Finland 2025, we got this cool LEGO Python logo that had batteries included:
If something above resonated with you, let's start a discussion about it! Email me at juhis@hamatti.org and share your thoughts. This year, I want to have more deeper discussions with people from around the world and I'd love if you'd be part of that.