When should you use generator expressions and when should you use list comprehensions in Python?
# Generator expression (x*2 for x in range(256)) # List com
Python 3.7:
List comprehensions are faster.
Generators are more memory efficient.
As all others have said, if you're looking to scale infinite data, you'll need a generator eventually. For relatively static small and medium-sized jobs where speed is necessary, a list comprehension is best.