class Counter(object): def __init__(self): self.i = [1,2,3,4,5,6] self.n = iter(self.i) def __call__(self): x = next(self.n) print('call',x) return x it = Counter() t1 = iter(it, 5) # it必须是callable的,否则无法返回callable_iterator for v in t1: print(v) # 结果 call 1 1 call 2 2 call 3 3 call 4 4 call 5