To set self.running_means[i] to new_val, you can do it in-place like this: self.running_means[i].data = new_val.
If you reassign the value with self.runnng_means[i] = new_val, the dict key points to the new value that is not stored in the buffer (the buffer has the old value).