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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com