Lesson 28.3 The yield Statement
From Hannah Lee
Making iterator classes is hard. In this video, we show an alternative, allowing us to write the iterator as a ‘function”. This requires the addition of a new python statement, the yield statement. As we shall see, using the statement turns the function into something else: a generator.