A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-February/152198.html below:

[Python-Dev] Dataclasses, frozen and __post_init__

[Python-Dev] Dataclasses, frozen and __post_init__Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 20 19:13:36 EST 2018
Steven D'Aprano wrote:
> So in principle, we could have a mutable class, and a immutable one, and 
> when you flick the switch, the instance.__class__ changes from mutable 
> to frozen.

That seems unfriendly to subclasses as well. To extend a class
you now need to subclass both the mutable and immutable versions
of the base class, ensure they share the behaviour they should
have in common (possibly by using a third mixin class) and
arrange for the freezing switch to install the immutable subclass
instead of the base one.

All of which seems like a huge amount of hassle just to save
an instance attribute. And I don't even want to think what
multiple inheritance would do to all this.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4