Nested loop limit?

Ville Vainio ville at spammers.com
Wed Jul 7 15:11:37 EDT 2004


>>>>> "Chad" == chad  <chad.himeda at hp.com> writes:

    Chad> I am writing a program to do some reliability calculations
    Chad> that require several nested for-loops.  However, I believe
    Chad> that as the models become more complex, the number of
    Chad> required for-loops will increase.  Does Python have a limit
    Chad> on the number of nested for-loops?  Thanks.

No idea (probably not), but if you even need to think of such a thing,
you might want to reconsider the design. 50 or so nested for loops
wouldn't even fit on the screen due to indentation.

Typically excessive nesting can be avoided by introduding a function.

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list