[reportlab-users] diagonal ShadedRect and Clipping ?

Dirk Datzert reportlab-users@reportlab.com
Sun, 11 Aug 2002 19:57:41 +0200


Hi Robin,

I had to change the lambda in centroid for me. The global function fn
was not found in lambda. Don't know why fn in centroid is global ?

def centroid(P):
    '''compute average point of a set of points'''
    fn = float(len(P))
    return reduce(lambda x,y,fn=fn: (x[0]+y[0]/fn,x[1]+y[1]/fn),P,(0,0))

Regards,
Dirk