Latest recipes tagged "cartesian_product" Code RecipesRecursive function to replace nested for loops (cartesian product) (Python) 2010-10-01T00:40:26-07:00Kieran <p style="color: grey"> Python recipe 577415 by <a href="/recipes/users/4175132/">Kieran</a> (<a href="/recipes/tags/cartesian_product/">cartesian_product</a>, <a href="/recipes/tags/code/">code</a>, <a href="/recipes/tags/for_loop/">for_loop</a>, <a href="/recipes/tags/python/">python</a>). Revision 3. </p> <p>Same functionality as the itertools product method (<a href="" rel="nofollow"></a>) with one major difference: generators are executed as the loop executes. An itertools product causes all the variables to be collected before the loop actually starts looping.</p>