- Define the class with a descriptive name:
- Write the __init__ method to include the object to which this object will be connected:
def __init__(self, raw_counter:Counter): self.raw_counter = raw_counter
We've defined a method function that takes a Counter object as an argument value. This Counter object is saved as part of the Counter_Statistics instance.
- Initialize any other local variables that might be useful. Since we're going to calculate values eagerly, the most eager possible time is when the object is created. We'll write references to some yet to be defined functions:
self.mean = self.compute_mean() self.stddev = self.compute_stddev()
We've eagerly computed the mean and standard ...