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

Sebastian Messing sebastianmessing at gmx.de
Thu Jan 31 05:14:56 EST 2013


Hello!

On 30.01.2013 19:02, Robin Becker wrote:
> A Python lister looked at my tests of your code and points out that the
> list comprehension is not equivalent to the loop.
>
> The loop produces [a,b,c,d,.....] whereas the comprehension is producing
> [[a,b],[c,d],.....], in this case we want the flat list of points
> because the Poly functions take [x0,y0,x1,y1,....] type lists of numbers.
Yes, you are right. I also missed this one. I did not know that for
lists l += [a, b] is equivalent to l.extend([a, b]) and not to
l.append([a, b]).

However, the script was still working. I took a look and found that
there is also code in PolyLine to make the list flat if it contains
tuples or lists as elements.

Thank you very much for your quick responses and your effort. I am sorry
that I used your time.

Best regards
Sebastian Messing
--
OsTech GmbH i.G.
Boxhagener Str. 76/78
10245 Berlin
Tel.: 030/2977304-23
Fax: 030/2977304-11


More information about the reportlab-users mailing list