title: Perform an action when a child method is executed
body: <p>I have a base class which describe what a encoding system looks like:</p>
  <pre class="lang-py prettyprint-override"><code>class Encoder(abc.ABC):
      def __init__(self):
          self._encode_time = []
          self._decode_time = []
  
      @abc.abstractmethod
      def encode(self, decoded_data: DataMapper, **kwargs) -&gt; Tuple[DataMapper, MetadataCollector]:
          pass
  
      @abc.abstractmethod
      def decode(self, encoded_data: DataMapper, metadata: MetadataCollector, **kwargs) -&gt; DataMapper:
          pass
  </code></pre>
  <p>This class is inherited by many other classes to describe different encoders.
  Now, I would like to add statistics to these models. For example, I would like to store the compression time  of encoding/decoding each time the function is called.</p>
  <p>For example, something like this :</p>
  <pre class="lang-py prettyprint-override"><code>class Encoder(abc.ABC):
      def __init__(self):
          self._encode_time = []
          self._decode_time = []
  
      @abc.abstractmethod
      def encode(self, decoded_data: DataMapper, **kwargs) -&gt; Tuple[DataMapper, MetadataCollector]:
          t1 = time.clock()
          child_call(decoded_data, **kwargs)
          self._encode_time.append(time.clock() - t1)
  </code></pre>
  <p>How can I do something like this without changing the code of all my children classes ?</p>