other item on iterations because its iterator object is created anew from supplemental class for each iterationit supports multiple active loops directly (this is file skipper py in the book' examples)#!python file skipper py class skipobjectdef __init__(selfwrapped)self wrapped wrapped def __iter__(self)return skipiterator(self wrappedclass skipiteratordef __init__(selfwrapped)self wrapped wrapped self offset def __next__(self)if self offset >len(self wrapped)raise stopiteration elseitem self wrapped[self offsetself offset + return item if __name__ ='__main__'alpha 'abcdefskipper skipobject(alphai iter(skipperprint(next( )next( )next( )for in skipperfor in skipperprint( yend='save item to be used new iterator each time iterator state information terminate iterations else return and skip make container object make an iterator on it visit offsets for calls __iter__ automatically nested fors call __iter__ again each time each iterator has its own stateoffset quick portability noteas isthis is -only code to make it compatibleimport the print functionand either use next instead of __next__ for -only useor alias the two names in the class' scope for dual / usage (file skipper_ py in the book' examples does)#!python from __future__ import print_function class skipiteratordef __next__(self)next __next__ / compatibility / compatibility when the appropriate version is run in either pythonthis example works like the nested loops with built-in strings each active loop has its own position in the string because each obtains an independent iterator object that records its own state information operator overloading