composing pipelines sometimes it is useful to create data processing pipelines pipeline is simply the composition of one or more functions where data items are sent to the first functionwhich then either discards the item (filters it outor passes it on to the next function (either as is or transformed in some waythe second function receives the item from the first function and repeats the processdiscarding or passing on the item (possibly transformed in different wayto the next functionand so on items that reach the end are then output in some way composing functions pipelines typically have several componentsone that acquires dataone or more that filter or transform dataand one that outputs results this is exactly the functional-style approach to programming that we discussed earlier in the section when we looked at composing some of python' built-in functionssuch as filter(and map(one benefit of using pipelines is that we can read data items incrementallyoften one at timeand have to give the pipeline only enough data items to fill it (usually one or few items per componentthis can lead to significant memory savings compared withsayreading an entire data set into memory and then processing it all in one go step action get_data(process(reporter( pipeline get_dataprocess(reporter())waiting waiting waiting pipeline send(" "read "awaiting waiting pipeline send(" "read "bprocess "awaiting pipeline send(" "read "cprocess "boutput " pipeline send(" "read "dprocess "coutput " pipeline send(" "read "edrop "doutput " pipeline send(" "read "fprocess "ewaiting waiting process "foutput " waiting waiting output " waiting waiting waiting finished finished finished close coroutines figure three-step coroutine pipeline processing six items of data figure illustrates simple three component pipeline the first component of the pipeline (get_data()acquires each data item to be processed in turn the second component (process()processes the data--and may drop unwanted data items--there could be any number of other processing/filtering componentsof course the last component (reporter()outputs results in the figure