This screenshot explains it best. http://i.imgur.com/omp3mSW.png
I'm using IPython 2.1 on Python 2.7
You can use %%time
or %%timeit
cell magics for multi-line blocks.
Thanks. I tried %%timeit already, but the call was on the same line and there was still an error. I tried moving it down now and it works. But it says "SyntaxError: invalid syntax" if a comment line precedes the one with %%timeit.
Yes, a cell magic has to be the only thing in that cell.
You can also use explicit line continuations to do it with a line magic:
%timeit f(1, \
2, \
3)
I got that error because there were two spaces after %%time
(!). I don't know if this is a known issue (?)
Most helpful comment
Yes, a cell magic has to be the only thing in that cell.
You can also use explicit line continuations to do it with a line magic: