[align] Correctly check the best value, closes #134571
authorVincent Michel <vincent.michel@logilab.fr>
Tue, 23 Apr 2013 16:56:10 +0200
changeset 252 6ae9fff68d2f
parent 251 45c3da28cbfb
child 253 3ef07383a65f
[align] Correctly check the best value, closes #134571 If the entry has already had a best match with a distance of O, the "not current_dist" will still be True and the value will be changed
aligner.py
--- a/aligner.py	Tue Apr 23 16:46:43 2013 +0200
+++ b/aligner.py	Tue Apr 23 16:56:10 2013 +0200
@@ -360,7 +360,7 @@
                     bestid, dist = sorted(matched[alignid], key=lambda x:x[1])[0]
                     #Get the better known distance
                     _, current_dist = cache.get(alignset[alignid][0], (None, None))
-                    if not current_dist or current_dist > dist:
+                    if current_dist is None or current_dist > dist:
                         #If it's better, update the cache
                         cache[alignset[alignid][0]] = (targetset[bestid][0], dist)
                         if dist <= equality_threshold: