[Tutor] List comprehension question

Richard D. Moores rdmoores at gmail.com
Fri Nov 12 17:00:23 CET 2010


On Fri, Nov 12, 2010 at 07:13, David Hutto <smokefloat at gmail.com> wrote:

> import timeit
>
>
> def anyName():
>        pass
>
> t = timeit.Timer('anyName()','from __main__ import anyName')
> print t.repeat(repeat=5)
>
>
> If I get the gist of what you're asking.
>

Yes. That's it! Thank you! And if I don't want the default number of 1
million, I can use
print t.repeat(repeat=5,number=3000)

See <http://tutoree7.pastebin.com/fUVs8CBj> where I compare speeds of
2 functions.

Dick


More information about the Tutor mailing list