Générateur Python dans la boucle
from itertools import takewhile
i = iter(range(10))
for x in takewhile({some logic}, i):
# do stuff
Expert--;
from itertools import takewhile
i = iter(range(10))
for x in takewhile({some logic}, i):
# do stuff