for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
class IncrementedNamedInt:
_last_int = 0
_names = {}
@classmethod
def get(cls, name):
cls._last_int += 1
cls._names[cls._last_int] = name
return cls._last_int
def name_of(cls, int):
return cls._names[int]
def get_for_name(cls, name):
for int in cls._names:
if cls._names[int] == name:
return int
raise Exception("Named int not found")