On Mon, Feb 25, 2008 at 7:49 AM, Joel B. Mohler <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>  I just noticed that the timeit short-cut seems more broken than normal (at
>  least I think this worked previous to 2.10.2:
>  sage: R.<x>=ZZ[]
>  sage: f=x^2-1
>  sage: timeit f.factor()
>  ------------------------------------------------------------
>    File "<ipython console>", line 1
>      timeit f.factor()
>             ^
>  <type 'exceptions.SyntaxError'>: invalid syntax
>
>  The ipython native %timeit still works though.
>
>  Is this breakage intentional?  trac ticket warranted?
>

If enabled Ipython will do automagic and just turn
"timeit foo" into "%timeit foo" if it happens that there
is no timeit symbol defined in the global namespace.
Sage-2.10.2 defines a timeit function which I think
is much better for Sage than the timeit that is builtin
to IPython.  In particular the one in Sage plays very
well with the Sage preparser but the one in Ipython
doesn't.   Also, I think it is easier to pass options (in
my opinion) since the Sage timeit is just a usual function.

You should use it like any function call,
and pass it a string:

sage: R.<x>=ZZ[]
sage: f=x^2-1
sage: timeit('f.factor()')
5 loops, best of 3: 133 µs per loop

Type timeit? for help and examples.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to