0
What is difference b/w generator and list comprehensions and creating a list by a loop
Why we use generators
1 Resposta
+ 4
Generator would use less memory, because it doesn't store the yielded values.
If you needed to store the values generator may not be the best choice.
List comprehension might be the fastest way to create a list.