how many nested for can we utilize?
Fredrik Lundh
fredrik at pythonware.com
Sun Aug 17 10:39:26 EDT 2008
Nick Dumas wrote:
> A good quote I read (I can't remember who it was from, though) is "If
> you need more than three levels of indentation, then something is
> seriously wrong with your code." Possibly Guido himself? Anyway. If
> you've got 100 levels of for, you're probably making things way harder
> than they need to be.
assuming 100 levels of for and 2 items in each sequence, you'll end up
with 1267650600228229401496703205376 iterations through the inner loop.
assuming each iteration takes a picosecond, it'll take approx 40
billion years to run the program.
</F>
More information about the Python-list
mailing list