On 07/05/2017 10:40 AM, Chris Angelico wrote:
> What would the lock surround?

Sorry yes I agree with you that no lock is needed in this method. I was
a bit confused by the code and probably was thinking something like "a
+= 1" in my head (even though that's not what he was doing...). Thanks
for clearing that up!

Regardless, depending upon what he means by this, he'll probably need
some form of syncronization at some point:

> What about if the variable is more complex, for example a list or
dictionary? Even in this case, is it safe to avoid locking on a shared
variable if the operation on the variable is performed in a single
Python instruction?

Cheers,
Thomas
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to