[Python-ideas] Python 3000 TIOBE -3%

Stefan Behnel stefan_ml at behnel.de
Fri Feb 10 15:59:45 CET 2012

Matt Joiner, 10.02.2012 15:48:
>> Pure python code running in python "threads" on CPython behaves like fibers.
>> I'd like to point out the word "external" in your statement.
> I don't believe this to be true. Fibers are not preempted. The GIL is
> released at regular intervals to allow the effect of preempted
> switching. Many other behaviours of Python threads are still native
> thread like, particularly in their interaction with other components
> and the OS.

Absolutely. Even C extensions cannot always prevent a thread switch from
happening when they need to call back into CPython's C-API.

> GIL + Threads = Simplified, non parallel interpreter

Note that this also applies to PyPy, so even "interpreter" isn't enough of
a generalisation.

I think it's best to speak of the GIL as what it is: a lock that protects
internal state of the CPython runtime (and also some external code, when
used that way). Rather convenient, if you ask me.


More information about the Python-ideas mailing list