New submission from AmjadHD <amjadbenhedh...@outlook.com>:
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. ---------- components: Library (Lib) files: timeit.py messages: 327261 nosy: amjad ben hedhili priority: normal severity: normal status: open title: add time decorator to timeit.py type: enhancement versions: Python 3.7 Added file: https://bugs.python.org/file47855/timeit.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34917> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com