Any time you are writing a method that returns a sequence (especially if that sequence is a list), I recommend you pause and think whether that method should actually be a generator. They can add tremendous flexibility and performance to your app.
What's a generator? Well, with regard to methods, it involves the keyword yield rather than return keyword in Python. The best way to describe how yield works is to write a method which is NOT a generator.
This video will show you how it works.
Auf dieser Seite können Sie das Online-Video Pythonic code: Tip 4 Processing large data sets with yield and generators mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Michael Kennedy 12 August 2016 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 7,275 Mal angesehen und es wurde von 129 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!