I'm using class attributes as a neat way to keep common strings used throughout my project. Parent class has an 'main' attribute that is used to compose other attributes.
Some of use cases need to use child class with this 'main' attribute changed. How can I force the child class to run the parent class attributes initialization for not-overridden attributes?
Basically, I want this code to work:
class One:
MAIN_ATTR = 'one'
COMPOSED_ATTR = ' '.join([MAIN_ATTR, 'composed'])
class Two(One):
MAIN_ATTR = 'two'
assert Two.COMPOSED_ATTR == 'two composed'