Could we not have a per-object lock, but only on objects the programmer defines as requiring thread safety?
if (obj.owner == current_thread):
# just get in and mess with it
elsif (obj.owner == shared):
# get in and mess with it under a lock
else
throw "not your obj - make this obj shared if you need that"
From a language perspective, you'd just need a way to declare that an object was 'shared'. All other objs would be owned by their creating thread.But Python is different than Java. The Python interpreter has to guard the internal data structures of the interpreter itself, and that is a lot more tricky than it seems on the surface.