[reportlab-users] Performance problem for lineplots with many values (with possible solutions)

Henning von Bargen H.vonBargen at t-p.com
Thu Jan 31 03:08:39 EST 2013


Hi,

It seems nobody noticed that the two approaches produce different
results:


> From: Sebastian Messing <sebastianmessing at gmx.de>

>

> I use ReportLab 2.6 but I also found the problem in ReportLab daily

from

> 01/29/2013 in /src/reportlab/graphics/charts/lineplots.py:

> 276 # Iterate over data columns.

> 277 if self.joinedLines:

> 278 points = []

> 279 for xy in row:

> 280 points += [xy[0], xy[1]]


This should generate a list of ints or floats.


> If I use a list comprehension instead, the plot is generated within

seconds or

> minutes:

> 278 points = [[xy[0], xy[1]] for xy in row]


This should generate a *list of lists* (each with length 2) of ints or
floats.

I wonder why the change should work at all.

HTH
Henning




More information about the reportlab-users mailing list