[Python-ideas] Timer that starts as soon as it is imported

anatoly techtonik techtonik at gmail.com
Tue May 26 20:05:06 CEST 2015


On Fri, May 22, 2015 at 1:58 PM, Oleg Broytman <phd at phdru.name> wrote:
> On Fri, May 22, 2015 at 12:59:30PM +0300, anatoly techtonik <techtonik at gmail.com> wrote:
>> Is the idea to have timer that starts on import is good?
>
>    No, because:
>
> -- it could be imported at the wrong time;

Any time is right.

> -- it couldn't be "reimported"; what is the usage of one-time timer?

The idea is to have convenient default timer to measure
script run-time.

> -- if it could be reset and restarted at need -- why not start it
>    manually in the first place?

Current ways of measuring script run-time are not cross-platform or
not memorizable. I have to reinvent timer code a couple of times, and
that's not convenient for the code that is only relevant while debugging.


More information about the Python-ideas mailing list