Issue
%%timeit
d = deque()
for i in range(40000):
d.appendleft(i)
The above code prints out the time of execution in Jupyter Notebook as: 3.39 ms ± 168 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) However, when I run this code in Python IDLE Shell, it indicates SyntaxError at % in %%timeit. How is that so?
Solution
Because %%
is Jupyter's "cell magic": https://ipython.readthedocs.io/en/stable/interactive/magics.html#cell-magics
It's not native Python syntax.
Answered By - Chen Xing
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.