I'm trying to set some default class variables in a base class so all subclasses are guaranteed to have a default value. Some of these I'd like to be dynamic based upon the subclass (DISPLAY_NAME in the example below). The use of __qualname__ in _ExtensionBase doesn't work because it sets DISPLAY_NAME to the static string "_ExtensionBase".
Is there a simpler way to do this, or any issues with the way I've found below? I haven't stumbled into any, bit it feels like pushing some limits of the intended uses of property and classmethod
class _ExtensionBase:
PRIORITY: float = 1.0
VERSION_STR: str = 'n/a'
@classmethod
@property
def DISPLAY_NAME(cls) -> str:
return cls.__name__
class ConcreteSubclass(_ExtensionBase): pass
assert ConcreteSubclass.DISPLAY_NAME == "ConcreteSubclass"