Making immutable instances

Paul Rubin http
Thu Nov 24 18:50:00 EST 2005


bkhl at stp.lingfil.uu.se (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