Making immutable instances

Paul Rubin http
Fri Nov 25 00:50:00 CET 2005

bkhl at (Björn Lindström) writes:
> As I said before, I think you're confusing the (in Python pretty
> non-existent) concept of encapsulation with Python's immutable types,
> which are immutable because the implementation demands it. (A fact I
> hope will disappear at some point.)

What implementation demand?  If Python's designers wanted mutable
strings or tuples, Python could have them.  Python strings and tuples
are immutable by design, not by accident of implementation.  Wanting
to make immutable class instances out of the same design
considerations is perfectly reasonable.

More information about the Python-list mailing list