Making immutable instances

Alex Martelli aleax at mail.comcast.net
Thu Nov 24 19:53:10 EST 2005


Giovanni Bajo <noway at sorry.com> wrote:
   ...
> > 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.)
> 
> You seriously believe that strings, integers and tuples are immutable because
> of implementation details? I believe they are part of a language design -- and
> a good part of it.

Definitely.  When I first designed gmpy, I wanted to make its number
types mutable, thinking this might probably enhance performance, but I
double checked with Python cognoscenti first -- and the result was a
plebiscite for IMmutable numbers (at the time, I was sort of new at
Python, and didn't really get it, but now I do;-).


Alex



More information about the Python-list mailing list