python property关键字
class Metric(object): def __init__(self, name): self.name = name self.sum = t(0.) self.n = t(0.) def update(self, val): self.sum += val self.n += 1 ...