explicitly and manuallyusing techniques of the preceding section (and grows to lines more than with yield)file squares_nonyield py class squaresdef __init__(selfstartstop)self start start self stop stop def __iter__(self)return squaresiter(self startself stopnon-yield generator multiscansextra object class squaresiterdef __init__(selfstartstop)self value start self stop stop def __next__(self)if self value =self stopraise stopiteration self value + return self value * this works the same as the yield multiscan versionbut with moreand more explicitcodepython from squares_nonyield import squares for in squares( )print(iend=' squares( iter(snext( )next( iter(snext( next( multiple iterators without yield squares( for in seach for calls __iter___ for in sprint('% :% (ij)end=' : : : : : : : : : finallythe generator-based approach could similarly remove the need for an extra iterator class in the prior item-skipper example of file skipper pythanks to its automatic methods and local variable state retention (and checks in at lines versus the original' )iterable objects__iter__ and __next__