Apr-12-2019, 07:02 AM
It is because
send()
runs the generator to the next yield statement, just like next()
. You can get the correct result with this codedef exYield2(bord_inf,bord_sup) : """Cette fonction avance de 2 en 2 entre des bords délimités""" valeurRecu = None while bord_inf < bord_sup : if valeurRecu is not None : bord_inf = valeurRecu valeurRecu = (yield bord_inf) bord_inf += 2