You can use xrange(N) that way Python doesn't have to build the 10000 item lists 20000 times. Other than that one would need to know why you would call do_job1 and do_job2 10000 times each inside a 10000 iteration loop. Most VERY large performance gains are due to better algorithms not code optimization.
Larry Bates [EMAIL PROTECTED] wrote: > Is there a better way to code nested for loops as far as performance is > concerned. > > what better way can we write to improve the speed. > for example: > N=10000 > for i in range(N): > for j in range(N): > do_job1 > for j in range(N): > do_job2 > -- http://mail.python.org/mailman/listinfo/python-list