I've been profiling some of my code which builds many somewhat complex

graphs. I've noticed that it spends almost all it's time in the

__init__ of the artist class. The time there is almost entirely spent

on calling identity_transform which builds a SeperableTransform that

does no transforming--from what I can tell--which is consistent with

the name. The identity transform function buid a bunch of other

objects all of which are the same each time. My question is, does it

really need to build all these objects over and over again. Given

that Artist's __init__ is called by so many things wouldn't it be

better to have some static constants to define these default

transformation functions? Am I missing something subtle or would this

be an improvement?

What do people think?

def zero(): return Value(0)

def one() : return Value(1)

def origin():

return Point( zero(), zero() )

def unit_bbox():

"""

Get a 0,0 -> 1,1 Bbox instance

"""

return Bbox( origin(), Point( one(), one() ) )

def identity_affine():

"""

Get an affine transformation that maps x,y -> x,y

"""

return Affine(one(), zero(), zero(), one(), zero(), zero())

def identity_transform():

"""

Get an affine transformation that maps x,y -> x,y

"""

return SeparableTransformation(unit_bbox(), unit_bbox(),

Func(IDENTITY),

Func(IDENTITY))