The future of Python immutability

sturlamolden sturlamolden at yahoo.no
Fri Sep 4 21:55:27 EDT 2009


On 4 Sep, 06:20, John Nagle <na... at animats.com> wrote:

> > 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.
>
>     That's an implementation problem with CPython.  I'm looking at this as
> a language design issue.  Shed Skin, which is garbage-collected, doesn't
> have that problem.  Look ahead to a new generation of Python implementations
> that go fast and use multiprocessors effectively.

But in that case, the problem is reference counting, not mutable
objects. If you get rid of reference counts you get rid of the GIL. At
the same time you introduce far worse problems: Memory use will
increase (garbage pile up), long pauses while garbage are collected
(very bad for servers), deallocator methods of extension types not
called when you expect them to. Java's VM may be faster than CPython's
VM, but it runs less smooth.













More information about the Python-list mailing list