is += in python thread safe?
python
Solution
`+=` is not threadsafe (source).
Problem
``` globalnum = 0 n = 1 class T( threading.Thread ): def run( self ): global globalnum globalnum += n for _ in xrange( 0, 999 ): t = T() t.start() print globalnum ``` the result is 999 In my test i seems += thread safe My question is: is += really thread safe?