DEV Community

Discussion on: What are race conditions?

Collapse
 
icncsx profile image
icncsx • Edited

Hi, Amaan. The CPython implementation of Python is single-threaded, so you won't run into that issue. If you want to explicitly introduce multi-threading, you would have to use a scheduler to ensure order/timing. See sched class: docs.python.org/3/library/sched.html

Either way, the GIL makes sure no two threads are active at the same time. That's why multi-threaded is concurrent not parallel.

Happy coding!