Python threading and sharing variables

Peter Otten __peter__ at web.de
Wed Jul 5 08:14:45 EDT 2017


Chris Angelico wrote:
> You can be confident that a single assignment will happen atomically.
> Even if "self.cnt = i" requires multiple instructions to perform

For name binding
cnt = i
maybe, but
self.cnt = i
can execute arbitrary Python code (think __setattr__()). With threads I'd 
rather play it safe.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /