This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amjad ben hedhili
Recipients amjad ben hedhili
Date 2018-10-06.23:46:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538869590.35.0.545547206417.issue34917@psf.upfronthosting.co.za>
In-reply-to
Content
I made this simple time decorator, it's not perfect but it does make python more pythonic :) :
it can be used as a decorator:
```
@timef
def fun_to_time(a, b):
    ...
```
or as a function call
`timef(print)("Hello world!")`
just a simple decorator no need for
`timeit.timeit("fun_to_time(a, b)", setup="from __main__ import a, b", number=1)`
it's also customizable as you can control number of repetitions, garbage collection, unit ...
and it produces a formatted output such as:
`fun_to_time: 24.1056 ms`.
It is somewhat badly written so waiting for your word people of wisdom :).
I think python needs this in the standard library as the current way is (sometimes) tedious.
History
Date User Action Args
2018-10-06 23:46:31amjad ben hedhilisetrecipients: + amjad ben hedhili
2018-10-06 23:46:30amjad ben hedhilisetmessageid: <1538869590.35.0.545547206417.issue34917@psf.upfronthosting.co.za>
2018-10-06 23:46:30amjad ben hedhililinkissue34917 messages
2018-10-06 23:46:30amjad ben hedhilicreate