[aligner] Don't append and pop. Check before.
authorSimon Chabot <simon.chabot@logilab.fr>
Fri, 09 Nov 2012 10:03:02 +0100
changeset 104 8322d728be8a
parent 103 d9be0462db20
child 105 aec512170eac
[aligner] Don't append and pop. Check before.
aligner.py
--- a/aligner.py	Fri Nov 09 10:02:25 2012 +0100
+++ b/aligner.py	Fri Nov 09 10:03:02 2012 +0100
@@ -57,9 +57,9 @@
         extraneighbours = aligntree.query_ball_tree(targettree, threshold)
         neighbours = []
         for ind in xrange(len(alignset)):
+            if not extraneighbours[ind]:
+                continue
             neighbours.append([[ind], extraneighbours[ind]])
-            if len(neighbours[-1][1]) == 0:
-                neighbours.pop()
         return neighbours
 
 #### Minhashing #####