03 September
A class without __repr__ wastes your time from the moment it exists. repr is for you, str is for the reader, and one of them has a sensible fallback.
Learn AI Coding, AI Agents and Software Engineering by Building Real Projects
A class without __repr__ wastes your time from the moment it exists. repr is for you, str is for the reader, and one of them has a sensible fallback.
self is a parameter name, not a keyword. __init__ does not create the object. And a class attribute is shared until the moment you assign through an instance.
Most classes in Python should have been functions. The test is not “is this a noun” — it is whether there is invalid state a class can prevent.
What the f actually compiles to, the whole format spec language, __format__, and the three jobs an f-string is the wrong tool for. Every output run on Python 3.12.