En Thu, 03 Sep 2009 15:03:13 -0300, John Nagle <na...@animats.com> escribió:

     Python's concept of immutability is useful, but it could be more
general.

     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.

In the current CPython implementation, every object has a reference count, even immutable ones. This must be a writable field - and here you have your race condition, even for immutable objects.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to