class Register(object): __shared_state = {} count = 0 def __init__(self): self.__dict__ = self.__shared_state def new(self): self.count += 1 return self.count