БГ
Size: a a a
БГ
R3
БГ
БГ
R3
БГ
py3
def gen(_max):
return list(range(_max)).__iter__()
g = gen(5)
while True:
try:
n = next(g)
print(n)
g.__setstate__(5)
except StopIteration:
break
0
БГ
БГ
py3
def gen(_max):
return list(range(_max)).__iter__()
g = gen(5)
while True:
try:
n = next(g)
print(n)
if n==2:
g.__setstate__(10)
except StopIteration:
print('stopped')
break
0
1
2
stopped
БГ
R3
БГ
БГ
R3
R3
БГ
R3
R3
R3
R3
R3