Learn To Loop The Python Way: Iterators And Generators Explained
If you’ve ever written any Python at all, the chances are you’ve used iterators without even realising it. Writing your own and using them in your programs can provide significant performance improvements, particularly when handling large datasets or running in an environment with limited resources. They can also make your code more elegant and give you “Pythonic” bragging rights.
Here we’ll walk through the details and show you how to roll your own, illustrating along the way just why they’re useful.
You’re probably familiar with looping over objects in Python using English-style syntax like this:
These kind of statements are …read more
Continue reading Learn To Loop The Python Way: Iterators And Generators Explained