Passing function objects to timeit

George Sakkis george.sakkis at gmail.com
Sun Mar 30 10:23:10 EDT 2008


On Mar 30, 9:03 am, Peter Otten <__pete... at web.de> wrote:
> Steven D'Aprano wrote:
> > On Sun, 30 Mar 2008 01:27:18 -0300, Gabriel Genellina wrote:
>
> >> Second try:
> > ...
> >> Horrible, I know. Those wrapper1,wrapper2,wrapper3... keep growing with
> >> each call. But it's the only way I could find, at least without changing
> >> the code template used by timeit.
>
> > Eeek. Talk about namespace pollution.
>
> > Thanks for the effort, but if that's the only solution, I think the
> > solution is worse than the problem!
>
> > Perhaps it's time for me to take a different approach.
>
> [snip]
>
> Maybe the following enhancement of timeit would be worthwhile?

[snip]


That would be great. I sometimes avoid timeit altogether because
setting up the environment is so cumbersome. Can you post the patch to
bugs.python.org so it doesn't get lost ?

George



More information about the Python-list mailing list