On Tue, Apr 26, 2016, at 12:12, Steven D'Aprano wrote:
> The obvious reason for overriding __new__ is to construct an immutable
> instance. You have to override __new__, because by the time it returns
> the
> instance is immutable and you can no longer initialise it.

Other than by subclassing an existing immutable type written in C, is it
actually possible to define a truly-immutable (rather than
contract-immutable) class in python?

(Of course, subclassing immutable C types is the more obvious answer to
when you have to override __new__).
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to