You can implement any of those things to existing datasets and there would be no difference. I don't think anyone using pytbon has ever gone "you know we could really use a new data type". Just seems so unnecessary. Implement it as a side library but now you just made the language more complex without true purpose
You can implement any of those things to existing datasets and there >would be no difference.
You can implement lots of things in Python from low-level objects but that doesn't mean we don't add them. You could say the same thing about default dicts, for instance. But if everyone is implementing the same thing over and over, isn't that the exact situation that calls for something to be added to the system libraries?
I don't think anyone using pytbon has ever gone "you know we could really use a new data type".
Huh? We've added ordered dicts, default dicts, frozen sets, named tuples, SimpleNameSpace, the Path object, and so many more over the history of Python.
As for me, when I discovered Python at the end of 2012, I asked right away "How do I make a record?" and discovered there wasn't a record/struct type.
Just seems so unnecessary. Implement it as a side library but now you just made the language more complex without true purpose
The dataclass decorator takes complexity out of the language! By using it you avoid the boilierplate of a large number of assignments in an init method, creating a repr method, possibly multiple comparison methods, etc.
As the summary on Raymond Hettinger's Pycon talk on dataclasses put it:
It will become an essential part of every Python programmer's toolkit. ...Dataclasses are shown to be the next step in a progression of data aggregation tools: tuple, dict, simple class, bunch recipe, named tuples, records, attrs, and then dataclasses. Each builds upon the one that came before, adding expressiveness at the expense of complexity.
Dataclasses are unique in that they let you selectively turn-on or turn-off its various capabilities and it lets the user choose the underlying data store (either instance dictionary, instance slots, or an inherited base class).
9
u/[deleted] May 16 '18
You can implement any of those things to existing datasets and there would be no difference. I don't think anyone using pytbon has ever gone "you know we could really use a new data type". Just seems so unnecessary. Implement it as a side library but now you just made the language more complex without true purpose