next(generators)
Table of Contents Introduction Slightly Beneath A yield return Duo Generator’s Lost Brother A yield yield Conundrum Context Managers Introduction One of python’s best features in my opinion is generators. I believe it allows for some pretty concise and expressive code, as well as handing out an ergonomic handle to lazy evaluation when needed.
That being said, there’s a lot more to them than meets the eye and you could do a lot more with generators than iterating and collecting data.