[Patches] [ python-Patches-728597 ] Make timeit.Timer more useful inside scripts.

SourceForge.net noreply@sourceforge.net
Sun, 27 Apr 2003 18:18:44 -0700


Patches item #728597, was opened at 2003-04-27 16:53
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=728597&group_id=5470

Category: Library (Lib)
Group: Python 2.3
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Make timeit.Timer more useful inside scripts.

Initial Comment:
The patch makes it possible to pass in an execution 
environment.  This makes it easier to instrument 
existing programs with timeit.

With the patch, the following script is possible:

import timeit

def f(x):
   return 3 * x + 1

print timeit.Timer('f(10)', env=globals()).repeat()


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2003-04-27 21:18

Message:
Logged In: YES 
user_id=6380

Sigh. Skip just proposed the same thing and I already
rejected it. You can use the setup argument for that.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=728597&group_id=5470