Generators and Coroutines
Let’s talk about the yield keyword in python. yield? So what is yield all about? Let’s fire up an IPython Read-Evaluate-Print-Loop (REPL) and dive right in with an example: In [1]: def yielder(): …: i = 5 …: while i > 0: …: yield i …: i -= 1 So what happens when we call…