Closed coleifer closed 6 years ago
By the by, the implementation of this feature is...ew.
Seems like asdict and astuple are obvious instance methods. Why are they implented at the module scope?
This repo exists only for the backport of the feature to 3.6, and is not for arguing the merits of adding dataclasses to the stdlib.
The time to argue this point has passed. The PEP has been accepted. If you really want to, I guess you could bring it up on python-dev, but I don't expect you'll get anywhere.
The reasons for using module scope are explained in #8.
I have read the pep and am at a complete loss why this is being included in the standard library. The pep acknowledges the primacy of the attrs project, as well as the benefit it has of being able to issue releases as often as necessary. Why, then, is this project, whose authors seem aware of it's inferiority, being added to the stdlib?
I've always used namedtuple, which can be subclassed and use the
__new__
method for specifying defaults, and found it perfect for this type of thing. When you consider all the noise added by the forced type annotations, are you actually saving anyone typing? Seems misguided and above all, unpythonic. I know I'm late to the party, but this just seems like another foolish addition to a language growing more bloated each release.