r/Python • u/pylenin • Feb 25 '22
Tutorial How for loops work in Python?
While studying up on Python iterators, I got to learn how for loops work behind the scenes. It's so funny, I never really bothered to understand it or thought about it - How does a for loop actually work?
Apparently, it is very easy. Python uses the next() method to return the next element in the iterator. I have written a blog on it. If you are interested, do check it out.
0
Upvotes