Nested loop limit?
tjreedy at udel.edu
Sun Jul 11 22:00:07 CEST 2004
"Bengt Richter" <bokr at oz.net> wrote in message
news:ccrucm$qbv$0 at 184.108.40.206...
> How many total executions of the innermost loop are you expecting?
> At 2 states per nested loop, ISTM you'd have 2**20 unless some logic
prunes it (not bad).
And there are at least two simple ways to extend the limit: a) have the
innermost loop call a function with its own set of nestings; b) flatten the
nesting with explicit cross-products, as in replacing
for a in [1,2]:
for b in [1,2]: # with
for a,b in [(1,1), (1,2), (2,1), (2,2)]:
Terry J. Reedy
More information about the Python-list