[Python-Dev] Dataclasses, frozen and __post_init__
Raymond Hettinger
raymond.hettinger at gmail.com
Tue Feb 20 18:24:02 EST 2018
More information about the Python-Dev mailing list
Tue Feb 20 18:24:02 EST 2018
- Previous message (by thread): [Python-Dev] Dataclasses, frozen and __post_init__
- Next message (by thread): [Python-Dev] Dataclasses, frozen and __post_init__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 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
- Previous message (by thread): [Python-Dev] Dataclasses, frozen and __post_init__
- Next message (by thread): [Python-Dev] Dataclasses, frozen and __post_init__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list