operation complexities of lists and dictionaries

Caleb Hattingh caleb.hattingh at gmail.com
Wed Mar 29 15:08:36 EST 2006


Hi

Use the "timeit" module, like so:

>>> from timeit import Timer
>>> t = Timer('[i for i in range(10000)]')  # The string is code to execute (for timing)
>>> print t.timeit(100) # execute it 100 times and print the result
0.222389936447

I would appreciate it if you could present your results in this thread.
 I have also been wondering about timings for simple operations.

Thanks
Caleb




More information about the Python-list mailing list