itertools.product: Nested For-Loops in a Generator Expression

itertools.product: Nested For-Loops in a Generator Expression

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).

My previous tips on itertools.

Search

Related Posts

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran