Hi
I have a class as follows:
class X:
def __init__(self):
self.sum_x =0.0
self.sum_x_squared=0.0
self.var_x =0.0
self.sum_y =0.0
self.sum_y_squared=0.0
self.var_y =0.0
def update(self,data):
[x,y,vx,vy]=data
self.update_sums(self.sum_x,self.sum_x_squared,x)
self.update_sums(self.sum_y,self.sum_y_squared,y)
.
def update_sums(self,sums,squares,val):
sums += val
squares += val*val
.
I would like to pass the member variables sum_x
, sum_x_squared
etc to the update_sums
function for update how do I do this, I am confused.
Thanks