文档中的示例
def test():
"""Stupid test function"""
L = []
for i in range(100):
L.append(i)
if __name__ == '__main__':
import timeit
print(timeit.timeit("test()", setup="from __main__ import test"))
但是如何调用带参数的函数,例如这样的函数:
def test(some_object):
"""Stupid test function"""
L = []
for i in range(100):
L.append(some_object)