I did something similar recently where I wanted child classes to be able to define additional values within attributes of their parents. You can do this using metaclasses, which allow you to hook into class creation in the same way that classes let you hook into instance creation.
In your case, for example, you could do something like:
class ListCombiner(type):
def __new__(cls, name, bases, dct):
l = []
for base in bases:
l = getattr(base, 'list', []) + []
dct['list'] = l + dct.get('list', [])
return type.__new__(cls, name, bases, dct)
class First(metaclass=ListCombiner):
list = []
def get_final_list(self):
return self.list
class Second(First):
list = ['one']
class Third(Second):
list = ['two']
Now the result is:
>>> Third().list
['one', 'two']
For more information on metaclasses, see e.g. What are metaclasses in Python?
If you're really interested, you can see where I introduced it in this commit; this shows how I was able to replace some awkward code with the metaclass. The fact that I was using sets made it slightly easier, as I didn't care about the order.