I have many similar classes, they all contain their own class attributes:
class MyClass1():
Context = ClassId1+"CONTEXTSTR"
SubContext = ClassId1+"SUBCONTEXTSTR"
UpVal = ClassID+"UPVAL"
DoenVal = ClassID1+"DOWNVAL"
class MyClass2():
Context = ClassId2+"CONTEXTSTR"
SubContext = ClassId2+"SUBCONTEXTSTR"
UpVal = ClassID2+"UPVAL"
DoenVal = ClassID2+"DOWNVAL"
...
but all this soon becomes annoying and requires a lot of code repetition (error-prone).
I would like to be able to manipulate a sort of class_variable and to do something like:
class MyClass1():
self_cls.MakeParameters(ClassId1)
even better if I could use inheritance and pass parameters to classes to do things like:
ClassID1 = "test01"
class MyClass1(BaseClass,<ClassID1>):
pass
print MyClass1.CONTEXT
obtaining as output "test01CONTEXTSTR" the code. How to do set the arguments of classes according to a given "template" that takes a parameter?