Is Python variable assignment atomic?

Simple assignment to simple variables is “atomic” AKA threadsafe (compound assignments such as += or assignments to items or attributes of objects need not be, but your example is a simple assignment to a simple, albeit global, variable, thus safe).

Leave a Comment