Open napsternxg opened 6 years ago
It works if you declare them as global
def f():
global f1, f2
def f1():
print("f1")
def f2():
print("f2")
def f3():
print("f3")
%time f1()
%time f2()
f3()
f()
Output:
f3
f1
CPU times: user 85 µs, sys: 25 µs, total: 110 µs
Wall time: 99.7 µs
f2
CPU times: user 10 µs, sys: 9 µs, total: 19 µs
Wall time: 19.1 µs
I think this is related to #9892
I am trying to use
%time
with nested function. When I run the code normally, I am able to execute my functions. But when I add%time
to each function call, the function fails with the messageNameError: name 'f1' is not defined
Reproducing the bug: This code runs perfectly, producing the output below:
Output:
This code causes the error described below.