5 ms·
that's a reference to my attrs library which is what data classes are based on. It originally used @attr.s class C: x = attr.ib() as its main
by hynek 1y ago
that's a reference to my attrs library which is what data classes are based on. It originally used
@attr.s
class C:
x = attr.ib()
as its main api (with `attr.attrs` and `attr.attrib` as serious business aliases so you didn't have to use it).
That API was always polarizing, some loved it, some hated it.
I will point out though, that it predates type hints and it was an effective way to declare classes with little "syntax noise" which made it easy to write but also easy to read, because you used the import name as part of the APIs.
Here is more context: https://www.attrs.org/en/stable/names.html https://www.attrs.org/en/stable/names.html
I REGRET NOTHING
- ericvsmith 1y agoFor what it’s worth, I was in the “loved it” camp. (I’m the author of dataclasses, and I owe an immeasurable debt to Hynek).
- sspies 1y agoThank you for creating dataclasses!
- g958198 1y agoif it's good enough for glyph, it's good enough for me