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
Use list comprehensions when the result needs to be iterated over multiple times, or where speed is paramount. Use generator expressions where the range is large or infinite.
See Generator expressions and list comprehensions for more info.