0
Can Not Understand The Flow Of This Coroutines Program Any One Help Me to Understand This Code
2 Antworten
+ 1
Lines 42-45 make it so you have new coroutines that wait at the line `token = (yield)` for input.
`producer` then splits the string, and sends the first token to pattern_filter, we hop from line 11 to line 23.
pattern_filter then sends the token to print_token, we hop from line 25 to line 37.
print_token prints the token on line 38 and loops, then waits on line 37 for more input.
pattern_filter does the same on line 23.
producer sends the next token and the whole thing starts over.
+ 2
That is unless producer runs out of words, which is when `token = (yield)` will throw an exception and we exit the `while True` loops.