I successfully implemented a Descriptor to clean up my code and it worked fine so far. At this moment my code looks basically like this
class ABC:
att1 = Descriptor(arg1)
att2 = Descriptor(arg2)
att3 = Descriptor(arg3)
However, to further reduce repititions, Id like to do something like this
class ABC:
att_arg = {'att1':arg1,
'att2':arg2,
'att3':arg3}
for att, arg in att_arg.items():
setattr(ABC, att, Descriptor(arg))
but this leads to a NameError: name 'ABC' is not defined.
Already thought about a wrapper class to do this, but does anyone know an elegant solution to this?