0
What are practical usage examples of Python generators?
3 Réponses
+ 4
Here I tried prime numbers with generators.
https://code.sololearn.com/cq8yCW6eL6xd/?ref=app
https://code.sololearn.com/cdC2Mtf12N7Z/?ref=app
+ 1
@Ferhat Sevim: I was wondering about real life scenarios of using generators
+ 1
If you use a long list, the whole list is stored in the memory. This is not a huge problem, if your memory is big enough. However in some cases you can have problems, for example in a microcontroller environment, where your devices are not as powerful as your PC. Generators will need some processing time, but they eat up much less memory.