HN Hall of Fame Weekly email

Using attrs for everything in Python

glyph.twistedmatrix.com Essays & writing Essays & articles Software engineering Class of 2021-12 Hall of Fame
Screenshot of glyph.twistedmatrix.com captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 3 calendar years, with breakout response in 2 of them.

submissions
8
submitters
8
observed span
2016–2021
peak thread · 111 comments
246 pts
latest 20+ return · 2021-12-24
151 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

While the conciseness of attrs is nice, it's not very readable. This: class Point3D(object): def __init__(self, x, y, z): self.x = x self.y = y self.z = z ...is much easier to read than this: import attr @attr.s class Point3D(object): x = attr.ib() y = attr.ib() z = attr.ib() Readability is what I love about Python. I don't think the conciseness of attrs is worth the loss in readability.

The @dataclass decorator [1] as proposed in PEP 557 [2] has also been available since Python 3.7 was released in 2018. Using @dataclass the example from OP would look like: from dataclasses import dataclass @dataclass class Point3D: x: float y: float z: float [1]: https://docs.python.org/3/library/dataclasses.html [2]: https://www.python.org/dev/peps/pep-0557/

If I'm not mistaken, python 3.7's data classes will make attrs mostly obsolete?

Actually, I consider the immutability of a `namedtuple` instance to be a benefit. I wish more things in Python were/could be immutable. I have been known to subclass `tuple` from time to time when I want both immutability and the ability to define methods. I wince when I see `namedtuple` being subclassed. Most users don't realise that the implementation of it actually builds up a giant string to pass to `eval()`... thoroughly nasty! At least it's hidden underneath the covers…

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
2

100+ points or 50+ comments

Total points
428

reference only — not used in Hall rules or ranking

Total comments
215

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2016-08-12The One Python Library Everyone Needsingve50
2016-08-13Attrs – a Python package for class decoratorsdanso40
2016-08-13The One Python Library Everyone Needsashitlerferad90
2016-08-14The One Python Library Everyone Needssciurus31
2016-08-23Attrs: the one python library that everyone needsmmariani50
2016-08-25Using attrs for everything in PythonFirst breakout · Best threadStavrosK246101
2018-05-26Attrs – The python library everyone needs (2016)lordvigm52
2021-12-24Attrs – the Python library everyone needs (2016)Hall induction · Latest 20+ point returnaqeelat151111