Are you using nested for-loops to experiment with different combinations of parameters? If so, use itertools.product
instead.
itertools.product
is more efficient than nested loop because product(A, B)
is equivalent to ((x,y) for x in A for y in B)
.