How to pass arguments to the function embedded in the timeit.Timer()
Gabriel Genellina
gagsl-py at yahoo.com.ar
Thu Jan 18 23:48:52 EST 2007
At Thursday 18/1/2007 21:31, Dongsheng Ruan wrote:
> Does anybody know how to pass multiple arguments to the function
>tested in timeit.timer() in
>python?
>
>I googled and found how to pass one argument:
>
>x=10000
>mytime = timeit.Timer( setup="from Createlst import createlst", stmt=
>"createlst(%s)"%(x) )
This is the % operator for strings, and it's general, not related to
the timeit module.
You can find it explained in almost every tutorial. The "official"
tutorial explains it here:
<http://docs.python.org/tut/node9.html#formatting> and for more
detailed usage see here:
<http://docs.python.org/lib/typesseq-strings.html>
If you haven't already done it, I strongly recommend reading the
Python tutorial (you should find it inside your Python installation,
and you can read it online at <http://docs.python.org/tut/> )
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list