these regular expressions ("regexesfrom now onmatch an html href' url and the text contained in and header tags (regular expressions are covered in understanding them is not essential to understanding this example receiver reporter(matchers (regex_matcher(receiverurl_re)regex_matcher(receiverh _re)regex_matcher(receiverh _re)generators since coroutines always have yield expressionthey are generators so although here we create tuple of matcher coroutinesin effect we are creating tuple of generators each regex_matcher(is coroutine that takes receiver function (itself coroutineand regex to match whenever the matcher matches it sends the match to the receiver @coroutine def regex_matcher(receiverregex)while truetext (yieldfor match in regex finditer(text)receiver send(matchthe matcher starts by entering an infinite loop and immediately suspends execution waiting for the yield expression to return text to apply the regex to once the text is receivedthe matcher iterates over every match it makessending each one to the receiver once the matching has finished the coroutine loops back to the yield and again suspends waiting for more text there is one tiny problem with the (undecoratedmatcher--when it is first created it should commence execution so that it advances to the yield ready to receive its first text we could do this by calling the built-in next(function on each coroutine we create before sending it any data but for convenience we have created the @coroutine decorator to do this for us def coroutine(function)@functools wraps(functiondef wrapper(*args**kwargs)generator function(*args**kwargsnext(generatorreturn generator return wrapper decorators the @coroutine decorator takes coroutine functionand calls the built-in next(function on it--this causes the function to be executed up to the first yield expressionready to receive data