The future of Python immutability
sturlamolden at yahoo.no
Sat Sep 5 07:27:17 CEST 2009
On 5 Sep, 07:04, Steven D'Aprano <st... at REMOVE-THIS-
> Your code does a lot of unnecessary work if you're just trying to
> demonstrate immutability is faster or slower than mutability.
No ... I was trying to compute D4 wavelet transforms. I wanted to see
how NumPy compared with Matlab.
> How does Matlab speed compare to Python in general?
Matlab is an example of a language that only has immutable types.
While it works well if you only play with small arrays, it is horrible
for complex data structures.
Also consider that appending to an array in Matlab always becomes O
(n**2), as the array cannot mutate like Python lists. Thus it is
impossible to amortize to linear complexity.
More information about the Python-list