4 ms·
> This, in turn, means that Python developers can utilize async code, multi-threaded code and never have to worry about acquiring locks on any variables or havi
by FartyMcFarter 7y ago
> This, in turn, means that Python developers can utilize async code, multi-threaded code and never have to worry about acquiring locks on any variables or having processes crash from deadlocks.
Dangerous advice. Whether this is true or not depends on lots of things such as how many and which operations you're doing on those variables.
Sure, CPython might do lots of simple operations atomically, but this is not enough to avoid the need for all locks. Threads can still interleave their execution in many ways.
See also: https://blog.qqrs.us/blog/2016/05/01/which-python-operations-are-atomic/ https://blog.qqrs.us/blog/2016/05/01/which-python-operations...