attrs: Bring Back the Joy of Writing Classes

attrs: Bring Back the Joy of Writing Classes

Do you find it annoying to write an __init__ method every time you want to create a class in Python? If so, try attrs.

attrs allows you to:

  • declaratively define the attributes of a class
  • get a nice human-readable __repr__ without extra code
  • turn attributes of an instance into a dictionary

Find other benefits of using attrs here.

Link to my previous tips on Python classes.

Search

Related Posts

2 thoughts on “attrs: Bring Back the Joy of Writing Classes”

Comments are closed.

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran