Input to %timeit is not preparsed #46

Closed
ipython opened this Issue May 10, 2010 · 2 comments

Projects

None yet

2 participants

@ipython
ipython commented May 10, 2010

Original Launchpad bug 296116: https://bugs.launchpad.net/ipython/+bug/296116
Reported by: fdo.perez (Fernando Perez).

%timeit should preparse the input just like %time does.

Bug reported at SageDays11.

@ipython
ipython commented May 10, 2010

[ LP comment 1 by: Fernando Perez, on 2008-11-13 07:01:48.986269+00:00 ]

Examples from sage showing the problem:

sage: %time 2r+2r
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
4

sage: %timeit 2r+2r

File "", line 6
2r+2r
^
SyntaxError: invalid syntax

sage: timeit('2r+2r')
625 loops, best of 3: 128 ns per loop
sage: timeit('2+2')
625 loops, best of 3: 1.84 µs per loop
sage: %timeit 2+2
10000000 loops, best of 3: 124 ns per loop

@takluyver
Member

Isn't it up to sage to do that preparsing? In any case, it seems to work correctly in current stable sage (4.6.2). Closing for now.

@takluyver takluyver closed this Mar 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment