The future of Python immutability

sturlamolden sturlamolden at
Sat Sep 5 04:23:06 CEST 2009

On 3 Sep, 20:03, John Nagle <na... at> wrote:

>      Python doesn't have immutable objects as a general concept, but
> it may be headed in that direction.  There was some fooling around
> with an "immmutability API" associated with NumPy back in 2007, but
> that was removed.  As more immutable types are added, a more general
> approach may be useful.

I one did a test of NumPy's mutable arrays against Matlab's immutable
arrays on D4 wavelet transforms. On an array of 64 MB of double
precision floats, the Python/NumPy version was faster by an order of
magnitude. On the other hand, immutable arrays does make
multithreading easier. They are particularly interesting for GPGPUs
(OpenCL/CUDA) where multithreading is pervasive. Also they allow
removal of temporary arrays, which are created by NumPy's binary

More information about the Python-list mailing list