Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In [1]: def f():
- ...: return 1
- ...:
- In [2]: %timeit f()
- 73.7 ns ± 1.16 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
- In [3]: def f():
- ...: def g():
- ...: return 1
- ...: return g()
- ...:
- In [4]: %timeit f()
- 217 ns ± 8.76 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
- In [5]: def f():
- ...: class C:
- ...: def f(self):
- ...: return 1
- ...: return C().f()
- ...:
- In [6]: %timeit f()
- 8.39 µs ± 94.1 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
Add Comment
Please, Sign In to add comment