__next__( __next__( __next__(error text omitted stopiteration or use next(in xnext(iin either line this initial step is not required for filesbecause file object is its own iterator because they support just one iteration (they can' seek backward to support multiple active scans)files have their own __next__ method and do not need to return different object that doesf open('script py'iter(fis true iter(fis __iter__(true __next__('import sys\nlists and many other built-in objectsthoughare not their own iterators because they do support multiple open iterations--for examplethere may be multiple iterations in nested loops all at different positions for such objectswe must call iter to start iteratingl [ iter(lis false __next__(attributeerror'listobject has no attribute '__next__i iter(li __next__( next( same as __next__(manual iteration although python iteration tools call these functions automaticallywe can use them to apply the iteration protocol manuallytoo the following interaction demonstrates the equivalence between automatic and manual iteration: [ for in lprint( * end=' automatic iteration obtains itercalls __next__catches exceptions technically speakingthe for loop calls the internal equivalent of __next__instead of the next(iused herethough there is rarely any difference between the two your manual iterations can generally use either call scheme iterationsa first look