What is the python syntax when a variable is after 'yield'?

50 Views Asked by At
def minimize():
    current = yield
    while True:
        value = yield current # what is this????
        current = min(value, current)

I got this piece of code from here. Here is the quote:

" The generator function receives the value passed to the send function as the result of the corresponding yield expression."

note: it says yeild expression, which mean the whole "yield current" thing. Is my understanding correct? If so, why not just use "yield", removing "current" from the expression??

0

There are 0 best solutions below