The global interpreter lock

In order to efficiently manage memory, garbage collection, and calls to machine code in native libraries, Python has a utility called the global interpreter lock, or GIL. It's impossible to turn off, and it means that threads are useless in Python for one thing that they excel at in other languages: parallel processing. The GIL's primary effect, for our purposes, is to prevent any two threads from doing work at the exact same time, even if they have work to do. In this case, doing work means using the CPU, so it's perfectly okay for multiple threads to access the disk or network; the GIL is released as soon as the thread starts to wait for something. This is why the weather example worked.

The GIL is highly disparaged, mostly by people who don't understand what it is or all the benefits it brings to Python. It would definitely be nice if our language didn't have this restriction, but the Python development team have determined that it brings more value than it costs. It makes the reference implementation easier to maintain and develop, and during the single-core processor days when Python was originally developed, it actually made the interpreter faster. The net result of the GIL, however, is that it limits the benefits that threads bring us, without alleviating the costs.

While the GIL is a problem in the reference implementation of Python that most people use, it has been solved in some of the non-standard implementations, such as IronPython and Jython. Unfortunately, at the time of publication, none of these support Python 3.