Adding a Par construct to Python?

Luis Zarrabeitia kyrie at
Wed May 20 17:59:26 CEST 2009

On Monday 18 May 2009 10:31:06 pm Carl Banks wrote:
> Even if you decided to accept the penalty and add locking to
> refcounts, you still have to be prepared for context switching at any
> time when writing C code, which means in practice you have to lock any
> object that's being accessed--that's in addition to the refcount lock.

While I agree that the GIL greatly simplifies things for the interpreter, I 
don't understand this statement. In practice, you should lock all critical 
sections if you expect your code to be used in a multithreading environment. 
That can't be different from what Java, C# or any other languages do, 
including C++. Why is that so expensive in python extensions, that it is used 
as an argument against removing the GIL?

Luis Zarrabeitia (aka Kyrie)
Fac. de Matemática y Computación, UH.

More information about the Python-list mailing list