<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
psyco might help a fair bit (10x-40x) here ;-><br>
perhaps look at dumping the data into sqlite then pulling it back out.
It (or the other databases) are designed for tossing around large lumps
of data.<br>
Alexzive wrote:
<blockquote
 cite="mid:099d9b31-0c04-4e82-91d1-b3ac9c02f037@m3g2000hsc.googlegroups.com"
 type="cite">
  <pre wrap="">Hello there :) ,

I am a python newbie and need to run following code for a task in an
external simulation programm called "Abaqus" which makes use of python
to access the mesh (ensamble of nodes with xy coordinates) of a
certain geometrical model.

[IN is the starting input containing the nodes to be check, there are
some double nodes with the same x and y coordinates which need to be
removed. SN is the output containing such double nodes]

Code: Select all
    for i in range(len(IN)): #scan all elements of the list IN
      for j in range(len(IN)):
        if i <> j:
         if IN[i].coordinates[0] == IN[j].coordinates[0]:
           if IN[i].coordinates[1] == IN[j].coordinates[1]:
              SN.append(IN[i].label)



Unfortunately my len(IN) is about 100.000 and the running time about
15h !!!! :(

Any idea to improve it?

I have already tried to group the "if statements" in a single one:

Code: Select all
    if i <> j and if IN[i].coordinates[0] == IN[j].coordinates[0] and
if IN[i].coordinates[1] == IN[j].coordinates[1]:


but no improvements.

Many thanks, Alex
--
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list</a>
  </pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<style type="TEXT/CSS">
                        
                        DIV.NAME
                                {Font-Family:"Lucida Sans Unicode";
                                 Font-Size:X-Large;
                                 Font-Weight:Bold;
                                 Color:#000000;
                                 Line-Height:1px;
                                 Text-Indent:60px;}

                        DIV.TITLE
                                {Font-Family:"Lucida Sans Unicode";
                                 Font-Size:Large;
                                 Font-Weight:Bold;
                                 Color:#004f05;
                                 Line-Height:5px;
                                 Text-Indent:60px;}

                        DIV.TEXT
                                {Font-Family:"Lucida Sans Unicode";
                                 Font-Size:Medium;
                                 Color:#000000;
                                 Line-Height:5px;
                                 Text-Indent:60px;}

                        DIV.VAPOUR
                                {Font-Family:"Bookman Old Style";
                                 Font-Size:XX-Large;
                                 Font-Weight:Bold;
                                 Font-Style:Italic;
                                 Line-Height:5px;
                                 Text-Indent:60px;}

                        DIV.TAG
                                {Font-Family:"Bookman Old Style";
                                 Font-Size:X-Large;
                                 Color:#000000;
                                 Line-Height:5px;
                                 Text-Indent:28px;
                                 Color:#004f05;
                                 Position:Relative;
                                 Top:-30px;}




                </style>
<div class="VAPOUR">
<p><font color="#004f05">Vapour</font> <font color="#15881b">Forge</font>
<img src="cid:part1.09090706.00080502@vapourforge.com"></p>
</div>
<div class="NAME">
<p>Jake Anderson</p>
</div>
<div class="TITLE">
<p>Project Manager</p>
</div>
<div class="TEXT">
<p>Mobile:       0412 897 125</p>
<p>Email:         <a class="moz-txt-link-abbreviated" href="mailto:jake@vapourforge.com">jake@vapourforge.com</a></p>
<p>Web Page:  <a class="moz-txt-link-abbreviated" href="http://www.vapourforge.com">www.vapourforge.com</a></p>
</div>
<div class="TAG">
<p><img src="cid:part1.09090706.00080502@vapourforge.com">Your source
for custom IT services</p>
</div>
</div>
</body>
</html>