I am trying to use timeit.timeit()
in order to find how much time it takes to execute a specific line of code.
The problem is that this line includes variables and I need to import them somehow, so my question is how?
In order to be more clear, the code looks something like this:
def func():
var1 = 'aaa'
var2 = 'aab'
t1 = timeit.timeit('var1==var2', 'from __main__ import ___', number = 10**4) # here I'm missing what to put after the import
If I were trying to execute this code in __main__
I would just import the variable directly with 'from __main__ import var1, var2'
Any solution for this kind of issue?