I have an immutable object (a float) that is "written" by one thread and read by another one. Do I need synchronization for that?
class Foo:
def __init(self):
self._bar = None
def writeAttribute(self, newValue):
self._bar = newValue
def readAttribute(self):
return self._bar
Note that writeAttribute and readAttribute are called from different threads for the same instance. My understanding is that readAttribute returns a "reference" either to the old value or the new one, but nothing in between.