[Python-ideas] add a time decorator to timeit.py

2018-10-07 Thread Amjad Ben Hedhili
I think that a time decorator will be a useful addition to the sandard library, as i find the current way of measuring execution time a bit tedious: timeit.timeit("fun_to_time(a, b)", setup="from __main__ import a, b", number=1) compared to: @timef def fun_to_time(a, b): ... or

Re: [Python-ideas] add a time decorator to timeit.py

2018-10-07 Thread Amjad Ben Hedhili
t but it works; you can control number of repetitions, garbage collection, unit ... and it produces a formatted output such as: `fun_to_time: 24.1056 ms`. ____________ De : Python-ideas de la part de Steven D'Aprano Envoyé : dimanche 7 octobre 2018 04:15 À : python-ideas@pyth

Re: [Python-ideas] add a time decorator to timeit.py

2018-10-07 Thread Amjad Ben Hedhili
@Steven D'Aprano , I know you didn't ask for the implementation, but it does supports the idea and it contains comments describing how it's used. @Chris Angelico, I don't know if it needs to be further customizable (apart from a repeat

Re: [Python-ideas] add a time decorator to timeit.py

2018-10-08 Thread Amjad Ben Hedhili
> Summary: Python's timeit.timeit() has an undocumented feature / > implementation detail that gives much of what the original poster has > asked for. Perhaps revising the docs will solve the problem. although timeit can be used with a callable, you need to create a lambda expression if the