title: Resetting/reloading class attributes of nested class at runtime
body: <p>I am using a nested class for "book keeping" purposes in Python 3. The class structure (highly simplified) looks something like this:</p>
  
  <pre><code>class BookKeeping:
  
      class ItemA:
          count = 0
          item_list = []
  
          @classmethod
          def add(cls, item_a):
              cls.count += 1
              cls.item_list.append(item_a)
  
      class ItemB:
          count = 0
          item_dict = {}
  
          ...
  </code></pre>
  
  <p>This class makes it convenient to keep track and to access some "global" properties of a system I am modelling. Having nested classes allows for clear namespacing. For instance, in any module I can <code>... import BookKeeping as BK</code> and check how many <code>ItemB</code> objects there are (<code>BK.ItemB.count</code>).</p>
  
  <p>At some point in my program I would like to "reset" all class attributes, i.e. I would like to set <code>BookKeeping.ItemA.count</code> to 0 again and empty lists and dictionaries, etc.</p>
  
  <p>Obviously, I could add a top-level class method like <code>BookKeeping.reset()</code> which resets all values "manually", like:</p>
  
  <pre><code>class BookKeeping:
  
      @classmethod
      def reset(cls):
          cls.ItemA.count = 0
          cls.ItemA.item_list = []
          cls.ItemB.count = 0
  
          ...
  </code></pre>
  
  <p>However, this seems to be an error-prone approach to me and it involves "maintenance" of this class (I might forget to reset some attributes). Please note, my real class is more complicated than the example I have provided.</p>
  
  <p>What is the easiest way to reset all class attributes to their original state at runtime?</p>