def next(self):
    if self.stop is not None:
        self.remaining = self.stop - self.count
if self.count >= self.stop:
    return False
self.count += 1
return True

def __call__(self):
    return self.__next__()
Pythonic перечисление цикла while