Lefkowitz: The One Python Library Everyone Needs
Twisted developer Glyph Lefkowitz writes about the attrs library for Python, which he calls "my favorite mandatory Python library". Instead of a lot of boilerplate to handle attributes in classes, attrs makes it far easier. "It lets you say what you mean directly with a declaration rather than expressing it in a roundabout imperative recipe. Instead of "I have a type, it's called MyType, it has a constructor, in the constructor I assign the property 'A' to the parameter 'A' (and so on)", you say "I have a type, it's called MyType, it has an attribute called a", and behavior is derived from that fact, rather than having to later guess about the fact by reverse engineering it from behavior (for example, running dir on an instance, or looking at self.__class__.__dict__)."