| Follow @jessejiryudavis
New York
I’m a staff engineer at MongoDB in New York City. I wrote Motor, the async MongoDB Python driver, and I’m the lead developer of the MongoDB C Driver. I contribute to PyMongo, asyncio, Python and Tornado. I study at the International Center for Photography and practice at the Village Zendo.
Authored Comments
Thanks Nate. Check out the bytecode: list.sort() is a single bytecode, so it cannot be interrupted. The documentation you refer to describes how a C extension must interact with a list, while it is being sorted, if the C extension is running a thread that does not hold the GIL. Your Python code always holds the GIL while it runs, and therefore it can never see a list *while* it is being sorted by another thread.