From f77f196cd332307ae89f61f7861b8a73923a7835 Mon Sep 17 00:00:00 2001 From: jcushman Date: Fri, 22 Jun 2012 18:11:45 -0300 Subject: [PATCH] 2x faster group_textboxes function. --- pdfminer/layout.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdfminer/layout.py b/pdfminer/layout.py index 14383f1..7e0f312 100644 --- a/pdfminer/layout.py +++ b/pdfminer/layout.py @@ -609,8 +609,8 @@ class LTLayoutContainer(LTContainer): group = LTTextGroupLRTB([obj1,obj2]) plane.remove(obj1) plane.remove(obj2) - dists = [ (c,d,o1,o2) for (c,d,o1,o2) in dists - if o1 in plane and o2 in plane ] + # this line is optimized -- don't change without profiling + dists = [ n for n in dists if n[2] in plane._objs and n[3] in plane._objs ] for other in plane: dists.append((0, dist(group,other), group, other)) dists.sort()