I want to create a class in python that includes class level constants for special instances of the class. i.e. something like this:
class Testing:
SPECIAL = Testing("special")
def __init__(self, name):
self.name = name
def test_specials():
norm = Testing("norm")
assert norm.name == "norm"
assert Testing.SPECIAL.name == "special"
If I try the above code, it fails saying: NameError: name 'Testing' is not defined
.
How should I model this?