The future of Python immutability

Nigel Rantor wiggly at
Thu Sep 3 21:30:40 CEST 2009

Stefan Behnel wrote:
> Nigel Rantor wrote:
>> John Nagle wrote:
>>>     Immutability is interesting for threaded programs, because
>>> immutable objects can be shared without risk.  Consider a programming
>>> model where objects shared between threads must be either immutable or
>>> "synchronized" in the sense that Java uses the term.
>>> Such programs are free of most race conditions, without much
>>> programmer effort to make them so.
>> I disagree. They are not free of most race conditions, and it still
>> takes a lot of effort. Where did you get this idea from? Have you been
>> reading some Java primer that attempts to make it sound easy?
> Read again what he wrote. In a language with only immutable data types
> (which doesn't mean that you can't efficiently create modified versions of
> a data container), avoiding race conditions is trivial. The most well known
> example is clearly Erlang. Adding "synchronised" data structures to that
> will not make writing race conditions much easier.

My comment you quoted was talking about Java and the use of 
synchronized. I fthat was unclear I apologise.

Please feel free to read the entirety of my post before replying.


More information about the Python-list mailing list