[Python-Dev] Dataclasses, frozen and __post_init__
Raymond Hettinger
raymond.hettinger at gmail.com
Tue Feb 20 18:24:02 EST 2018
> On Feb 20, 2018, at 2:38 PM, Guido van Rossum <guido at python.org> wrote:
>
> But then the class would also inherit a bunch of misfeatures from tuple (like being indexable and having a length). It would be nicer if it used __slots__ instead.
FWIW, George Sakkis made a tool like this about nine years ago. https://code.activestate.com/recipes/576555-records It would need to be modernized to include default arguments, types annotations and whatnot, but otherwise it has great performance and low API complexity.
> (Also, the problem with __slots__ is the same as the problem with inheriting from tuple, and it should just be solved right, somehow.)
Perhaps a new variant of __init_subclass__ would work.
Raymond
More information about the Python-Dev
mailing list