Easier Classes: Python Classes Without All The Cruft
summary
Builds concrete Month and point class examples and shows which helpers actually implement dunder methods for you: namedtuple gives immutability and repr but inherits tuple quirks (ordering, length, addition), attrs is pip-install third party and is more feature-rich, and dataclasses (built into Python 3.7 but pip-installable otherwise) produces init, repr, equality, and can be frozen and made iterable (as_tuple or __iter__); friendly classes end up under ten lines and really do remove boilerplate.
AI-written summary · about
chapters (5)
- 0:00Start
- 4:33Class Immutable
- 11:08Data Classes
- 14:10Data Classes Is Built In to the Python Standard Library
- 17:16Dunder Methods
related talks
32mEasier Classes: Python Classes Without All the Cruft
26mEverything you need to know but were afraid to ask about Data Classes
45mDataclasses: The code generator to end all code generators
33mElegant Solutions For Everyday Python Problems
46mOn Being Pythonic
47mA Deep-Dive Into Python Classes
59mFun with Python's newer tools
01h 10mIt's Pythons All The Way Down: Python Types & Metaclasses Made Simple
