knowing design pattern and choosing to use it in our software does nothoweverguarantee that we are creating "correctsolution in the quebec bridge (to this daythe longest cantilever bridge in the worldcollapsed before construction was completedbecause the engineers who designed it grossly underestimated the weight of the steel used to construct it similarlyin software developmentwe may incorrectly choose or apply design patternand create software that "collapsesunder normal operating situations or when stressed beyond its original design limits any one design pattern proposes set of objects interacting in specific way to solve general problem the job of the programmer is to recognize when they are facing specific version of that problemand to adapt the general design in their solution in this we'll be covering the iterator design pattern this pattern is so powerful and pervasive that the python developers have provided multiple syntaxes to access the object-oriented principles underlying the pattern we will be covering other design patterns in the next two some of them have language support and some don'tbut none of them is as intrinsically part of the python coder' daily life as the iterator pattern iterators in typical design pattern parlancean iterator is an object with next(method and done(methodthe latter returns true if there are no items left in the sequence in programming language without built-in support for iteratorsthe iterator would be looped over like thiswhile not iterator done()item iterator next(do something with the item in pythoniteration is special featureso the method gets special name__next__ this method can be accessed using the next(iteratorbuilt-in rather than done methodthe iterator protocol raises stopiteration to notify the loop that it has completed finallywe have the much more readable for item in iterator syntax to actually access items in an iterator instead of messing around with while loop let' look at these in more detail