Bruno Desthuilliers wrote: > From a purely efficiency POV, there are some obviously possible > improvements. The first one is to alias visual.cylinder, so you save on > lookup time. The other one is to avoid useless recomputation of > -hatch_length and hatch_length*2. > > def _create_3D_xhatches(): > cy = visual.cylinder > for x in xrange(-axis_length, axis_length + 1): > if x == 0: continue > b = -hatch_length > c = hatch_length*2 > cy(pos=(x, b, 0), axis=(0, c, 0), radius=hatch_radius) > cy(pos=(x, 0, b), axis=(0, 0, c), radius=hatch_radius) > cy(pos=(b, x, 0), axis=(c, 0, 0), radius=hatch_radius) > cy(pos=(0, x, b), axis=(0, 0, c), radius=hatch_radius) > cy(pos=(b, 0, x), axis=(c, 0, 0), radius=hatch_radius) > cy(pos=(0, b, x), axis=(0, c, 0), radius=hatch_radius)
Doesn't this call to "cy" still call the function multiple times? -- http://mail.python.org/mailman/listinfo/python-list