Nested loop limit?

Michele Simionato michele.simionato at gmail.com
Mon Jul 12 07:11:40 EDT 2004


Dan Christensen <jdc at uwo.ca> wrote in message news:<873c3ycvdq.fsf at uwo.ca>...
> Yes, I've considered it, and in fact I'll be forced to use a
> table-driven approach to handle more general situations, where the
> geometry is read in from a file.  I haven't done timing comparisons,
> but I would be very surprised if it was faster.  There would be some
> beneficial cache effects from the shorter code, but more lookups and
> index shuffling which I would expect to slow things down.  But maybe
> I'm not familiar with some tricks that would make this technique
> faster. 
> 
> As for maintainability of my method, using the macros means that
> writing the code is very similar to filling in the table in the first
> place!  :-)
> 
> I've actually toyed with the idea of having the program generate the
> code (maybe in Python) on the fly, compile it (e.g. with psyco), and
> then run it.  But with Python's limit of 20 nested loops, that won't
> fly. 
> 
> Dan

You should consider writing your code in Lisp if have in mind that kind
of tricks (not that I claim that would be the right way to go, more
likely not).

BTW, just out of curiosity, what kind of computation are you trying to
perform? Is it in the context of loop quantum gravity, or Regge calculus,
or just general relativity?

You would be surprised by the backgrounds of people reading c.l.p. ...


            Michele Simionato



More information about the Python-list mailing list