while trueincrement yield score score +increment this code looks like black magic that couldn' possibly workso we'll see it working before going into line-by-line description this simple object could be used by scoring application for baseball team separate tallies could be kept for each teamand their score could be incremented by the number of runs accumulated at the end of every half-inning look at this interactive sessionwhite_sox tally(blue_jays tally(next(white_sox next(blue_jays white_sox send( blue_jays send( white_sox send( blue_jays send( first we construct two tally objectsone for each team yesthey look like functionsbut as with the generator objects in the previous sectionthe fact that there is yield statement inside the function tells python to put great deal of effort into turning the simple function into an object we then call next(on each of the coroutine objects this does the same thing as calling next on any generatorwhich is to sayit executes each line of code until it encounters yield statementreturns the value at that pointand then pauses until the next next(call so farthenthere' nothing new but look back at the yield statement in our coroutineincrement yield score