http://bugs.python.org/issue19495 timeit enhancement

M

Mark Lawrence

The request is for a class within timeit that allows you to test code
inside a with block. It strikes me as being useful but there's only one
response on the issue, albeit a positive one. If others here think this
would be a useful addition I'll see if I can take this forward, unless
there are any timeit fans lurking who'd like to run with it themselves.
 
S

Steven D'Aprano

The request is for a class within timeit that allows you to test code
inside a with block. It strikes me as being useful but there's only one
response on the issue, albeit a positive one. If others here think this
would be a useful addition I'll see if I can take this forward, unless
there are any timeit fans lurking who'd like to run with it themselves.

I have a Stopwatch() context manager which I have been using for a long
time, very successfully. There's an early version here:

http://code.activestate.com/recipes/577896

I'll clean it up and submit it on the bug tracker.
 
C

Cameron Simpson

I have a Stopwatch() context manager which I have been using for a long
time, very successfully. There's an early version here:

http://code.activestate.com/recipes/577896

I'll clean it up and submit it on the bug tracker.

And I have a LogTimer context manager that emits a log message when a with
suite exceeds a threshold.

I'm sure it is far cruder and limited than Steven's; I'm mentioning it in
support of the use case.

Cheers,
Cameron Simpson <[email protected]>

1993 Explorer - Cage? Hell, it's a prison. - Will Hartung (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top