As Stephan said, you can investigate the timeit module. If you want to
test it your way, wrap up your function call in another function:

On May 10, 9:27 am, mosscliffe <[EMAIL PROTECTED]> wrote:
...
> def timeloop(dofunction,iters=10):
...
>
> def lookup(recs,patterns):
...

> myrecs = ...
>
def test1():
    lookup(myrecs, ['one', 'nomatch'])

def test2():
    lookup(myrecs, ['one', 'two'])

> timeloop(test1, 10)

Using timeit:

t = timeit.Timer("lookup(myrecs, ['one', 'nomatch'])", "from __main__
import *")
print t.timeit(10)

--
Ant.



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to