因为 GIL(全局解释器锁), python 只有一个 GIL, 运行时只有拿到这个锁才能执行,同一时间只有一个获得 GIL 的线程在跑,其他线程都在等待状态。
相当于每个 CPU 在同一时间只能执行一个线程。
Python’s simplicity lets you become productive quickly, but this often means you aren’t using everything it has to offer. With this hands-on guide, you’ll learn how to write effective, idiomatic Python code by leveraging its best—and possibly most neglected—features. Author Luciano Ramalho takes you through Python’s core language features and libraries, and shows you how to make your code shorter, faster, and more readable at the same time.