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.
Nesta página do site você pode assistir ao vídeo on-line Pythonic code: Tip 4 Processing large data sets with yield and generators duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Michael Kennedy 12 Agosto 2016, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 7,275 vezes e gostou 129 espectadores. Boa visualização!