The future of Python immutability
bearophileHUGS at lycos.com
Sun Sep 6 15:39:01 CEST 2009
> The concept here is that objects have an "owner", which is either
> a thread or some synchronized object. Locking is at the "owner"
> level. This is simple until "ownership" needs to be transferred.
> Can this be made to work in a Pythonic way, without explicit
> What we want to happen, somehow, is to
> transfer the ownership of "words" from the calling thread to the object
> in "putitem", and transfer it to the calling thread in "getitem".
> How can this be done?
There are several people that have found ways to implement such owning
of variables, for example Bartosz Milewski:
It requires some extra complexities, so statically typed languages
usually don't implement this idea, even if it avoids bugs in user
Implementing it in Python in a simple enough way looks like a good
topic for advanced research :-)
More information about the Python-list