[IPython-User] iPython notebook and statements that span multiple lines

Matthias BUSSONNIER bussonniermatthias@gmail....
Mon Nov 12 04:58:54 CST 2012


Le 12 nov. 2012 à 11:48, William Furnass a écrit :

> I'm wanting to use the 'timeit' and 'prun' magic commands in ipython notebook 0.13.1 to profile multi-line statements.  Attempts to do this cause 'Unexpected indent errors to be thrown up though:

line magic (one leading %) run only on one line.
use cell magic (2 leading %) for multiline (whole cell in notebook)


######
%%timeit
x= [1,2,3]
for i in x:
   whatever(i,x)
######
-- 
Matthias




> 
> In [3]:
> %timeit -r1 -n1 x = [1,2,3]
> 1 loops, best of 1: 2.15 us per loop
> In [4]:
> %timeit x = [1,
>              2,
>              3] 
> IndentationError: unexpected indent
> 
> 
> 
> Is this a bug or am I missing something obvious here?
> 
> Cheers,
> 
> Will
> 
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20121112/6056188f/attachment.html 


More information about the IPython-User mailing list