[Python-Dev] Intricacies of calling __eq__

Hrvoje Niksic hrvoje.niksic at avl.com
Wed Mar 19 14:08:13 CET 2014


On 03/18/2014 10:19 PM, Paul Moore wrote:
> Surely in the presence of threads the optimisation is invalid anyway

Why? As written, the code uses no synchronization primitives to ensure 
that the modifications to the dict are propagated at a particular point. 
As a consequence, it cannot rely on the modification done at a time that 
coincides with execution at HERE to be immediately propagated to all 
threads.

The optimization is as valid as a C compiler rearranging variable 
assignments, which also "breaks" unsychronized threaded code.



More information about the Python-Dev mailing list