aleax at aleax.it
Sun Jun 15 19:49:41 CEST 2003
> i tried timeit for the first time today, pretty darn impressive. i've
> noticed that postings in this newsgroup use timeit on the command line and
> with usually just one simple statement or loop.
Actually I also use it on the command line with several statements (on
Unix with the Bash shell making it convenient).
> is this the only way to
> can timeit be used within a script?
Of course. You can import it and use its Timer class.
> or to execute whole scripts?
> i guess the obvious anwer that one is:
> timeit -s"import myscript" "myscript.main()"
Of course, that's quite acceptable, too.
> i'm just curious how other are exploiting timeit.
So far I'm mostly using it from the command line, but the facilities
for using it as an imported module seem also excellent.
More information about the Python-list