54 I TERATORS What does a for -loop do under the hood? for x in iterable: function(x) is equivalent to iterator = iterable.__iter__() try: while True:
{"Image DocumentName": "Iterators", "Image ImageDescription": "What does a for-loop do under the hood ? for x in iterable: function(x) is equivalent to iterator = iterable.__iter__() try: while True: element = iterator.__next__() function(element) except StopIteration as e: pass Create an iterator. Try to get an element from the iterator. Apply the function on the element. If we could not get an element, we catch the StopIteration exception and do not apply the function.", "Image XResolution": "37", "Image YResolution": "37", "Image ResolutionUnit": "Pixels/Centimeter", "Image Software": "SlidePlayer", "Image YCbCrPositioning": "Centered"}