Hello,

I'm interested in doing a bunch of timing, so I'd like to put %time or
%timeit statements inside a loop. But there's a problem: if I type out
something like

  sage: for n in [1..5]:
  ....:     print 'n is %d' % n
  ....:     %time N(pi**n)
  ....:

I get the expected output, but if I want to change something -- say, pi
to sqrt(2), if I hit the up arrow twice and edit the lines, I get this:

  sage: for n in [1..5]:
      print 'n is %d' % n
      %time N(sqrt(2)**n)
  ------------------------------------------------------------
     File "<ipython console>", line 3
       %time N(sqrt(2)**n)
       ^
  SyntaxError: invalid syntax

I know the % functions are special IPython things, but why do they work
when I type things in manually, but not when I hit the arrows to go
back?

Dan

-- 
---  Dan Drake <dr...@kaist.edu>
-----  KAIST Department of Mathematical Sciences
-------  http://mathsci.kaist.ac.kr/~drake

Attachment: signature.asc
Description: Digital signature

Reply via email to