I have read the documentation of the timeit module and also you can pass a 
function (without arguments) to it (e.g. 
https://stackoverflow.com/questions/5086430/how-to-pass-parameters-of-a-function-when-using-timeit-timer).

My needs are:
- simple way to instrument my code to log time for a function or a code block 
(I am not writing a specific script to time/benchmark a specific code)
- have the timing sent to some logger
- be the less intrusive possible

With the Timer proposed here above (bad naming as Timer already exists in the 
timeit module, maybe Clocker ?), I can simply:
- decorate a function with it and I am done
- wrap an existing code with it as context manager

I thank you for the suggestions already made but they do not fit in my need/use 
case in a nice/pythonic way.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/DCYNRUABZOI3VQUUQNQO7UUUHANZ75ZZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to