coroutines abuse the iterator protocol but don' actually fulfill the iterator pattern can you build non-coroutine version of the code that gets serial number from log filetake an object-oriented approach so that you can store an additional state on class you'll learn lot about coroutines if you can create an object that is drop-in replacement for the existing coroutine see if you can abstract the coroutines used in the case study so that the -nearest-neighbor algorithm can be used on variety of datasets you'll likely want to construct coroutine that accepts other coroutines or functions that do the distance and recombination calculations as parametersand then calls into those functions to find the actual nearest neighbors summary in this we learned that design patterns are useful abstractions that provide "best practicesolutions for common programming problems we covered our first design patternthe iteratoras well as numerous ways that python uses and abuses this pattern for its own nefarious purposes the original iterator pattern is extremely object-orientedbut it is also rather ugly and verbose to code around howeverpython' built-in syntax abstracts the ugliness awayleaving us with clean interface to these object-oriented constructs comprehensions and generator expressions can combine container construction with iteration in single line generator objects can be constructed using the yield syntax coroutines look like generators on the outside but serve much different purpose we'll cover several more design patterns in the next two