On Thu, 23 Oct 2008 05:03:26 -0700, Jani Tiainen wrote: > But in my case running that loop takes about 10 minutes. What I am doing > wrong?
Others have already suggested you have a O(N**2) algorithm. Here's an excellent article that explains more about them: http://www.joelonsoftware.com/articles/fog0000000319.html The article is biased towards low-level languages like C. In Python the way to avoid them is to use sets or dicts, or to keep the list sorted and use the bisect module. -- Steven -- http://mail.python.org/mailman/listinfo/python-list