[Python-ideas] Concurrent safety?

Amaury Forgeot d'Arc amauryfa at gmail.com
Mon Oct 31 15:33:35 CET 2011


Hi,

2011/10/31 Mike Meyer <mwm at mired.org>

> Any attempt to mutate an object that isn't currently locked will raise
> an exception. Possibly ValueError, possibly a new exception class just
> for this purpose. This includes rebinding attributes of objects that
> aren't locked.
>

PyPy offers a nice platform to play with this kind of concepts.
For example, even if it's not the best implementation, it's easy to add a
__setattr__ to the base W_Object class, which will check whether the object
is allowed to mutate.

But you certainly will open a can of worms here: even immutable objects are
modified (e.g str.__hash__ is cached) and many functions that you call will
need to add their own locks, is it possible to avoid deadlocks in this case?


-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111031/aa8f11c2/attachment.html>


More information about the Python-ideas mailing list