0
What's the true purpose of generators? Why not use lists and range function instead?
2 Answers
0
"Using generators results in improved performance, which is the result of the lazy (on demand) generation of values, which translates to lower memory usage. Furthermore, we do not need to wait until all the elements have been generated before we start to use them."
This is taken straight from the third part of this module :)
- 3
No tener una lista preconcebida, ir generando sobre la marcha.