I'm attempting to use a composition over inheritance design concept, and I've been storing the creator and main_actor of every component. This overall looks very repetitive and ugly, so I'm wondering if there's a way to make it nicer.
class ComponentA:
def __init__(self, **kwargs):
self.creator = kwargs['creator']
self.main_actor = kwargs['main_actor']
self.b = ComponentB(creator=self, main_actor=self.main_actor)
self.c = ComponentC(creator=self, main_actor=self.main_actor)
# instead of that, i want to achieve the same,
# without the eye sore of the repetitive kwargs:
self.b = ComponentB()
self.c = ComponentC()
# perhaps with metaclasses? or a function?
self.b = make(ComponentB)
self.c = make(ComponentC)