Open gabrieldemarmiesse opened 4 years ago
This is a bug in IPython that was fixed in version 6.2 (see https://github.com/ipython/ipython/commit/6d2b31146a00a1fbe8a36a8609daa0e9a8b13018). Colab currently uses IPython 5.5.
As a workaround, you can declare the variable globally:
def get_times():
global a
a = 8
%timeit a + 1
get_times()
10000000 loops, best of 3: 32.9 ns per loop
Thank you!
or you can run in colab cell: !pip install --upgrade IPython
Bug report for Colab: http://colab.research.google.com/.
For questions about colab usage, please use stackoverflow.
get_times()
NameError Traceback (most recent call last)