title: can I add Python classes together?
body: <p>I want to combine two (or more) Python classes together in a way that may not work with subclassing. I start with</p>
  <pre><code>class Foo:
      def process(self):
          print(self.fields)
          print(self.items)
  
  class AFoo(Foo):
      fields = ['a', 'A']
      items = ['dog', 'cat']
  
  class BFoo(Foo):
      fields = ['b', 'B', 'Bee']
      items = ['badger', 'potato']
  </code></pre>
  <p>and I want to define combined classes such as <code>ABFoo</code> where <code>fields</code> and <code>items</code> are the sum  of fields and items in the base classes.
  I think I may be able to write something like this, but it's unwieldy:</p>
  <pre><code>class ABFoo(AFoo, Bfoo):
      fields = [f for cls in ABFoo.__bases__ for f in cls.fields]
      items  = [f for cls in ABFoo.__bases__ for f in cls.items]
  </code></pre>
  <p>I think this might be an application for a metaclass, but I still don't really understand them. Note that I want to define a combined <strong>class</strong> not add two <strong>objects</strong> of these classes together.</p>