Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018年2月20日 15:34:20 -0800

> On Feb 20, 2018, at 2:38 PM, Guido van Rossum <[email protected]> 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
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to