Open ZhiyuanChen opened 4 years ago
@zyc-ai a comprehension list is faster than a loop
a comprehension list is faster than a loop
It seems not in the case of Python https://stackoverflow.com/a/43677631/8791650.
a comprehension list is faster than a loop
It seems not in the case of Python https://stackoverflow.com/a/43677631/8791650.
I beg to diff, consider doing this instead
def square_sum4(numbers): return(sum([i**2 for i in numbers]))
Slightly increase spped by reducing two for loop to one