This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wanted to test the penalty for using imports inside functions. | |
import timeit | |
def t1(): | |
return 2 * 2 | |
timeit.timeit("t1()", setup="from __main__ import t1") | |
#> 0.14718103408813477 |