Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%%timeit should warn of empty contents #2862

Closed
takluyver opened this issue Jan 28, 2013 · 5 comments
Closed

%%timeit should warn of empty contents #2862

takluyver opened this issue Jan 28, 2013 · 5 comments
Milestone

Comments

@takluyver
Copy link
Member

I accidentally used %%timeit when I meant to use %timeit in the notebook (tab completion makes this all too easy). This means that the expression I thought I was timing was being treated as the setup expression, and it was actually looping over an empty block. I thought those speedups were too good to be true.

For %%timeit, and perhaps for line+cell magics in general, it would be good to get some warning on an empty main block, in case the user meant to use the line version.

@rlmv
Copy link
Contributor

rlmv commented Feb 1, 2013

It looks like this can't be a general line+cell feature without changing the specification for %%prun, since %prun and %%prun with an empty cell produce the same output.

That said, %%timeit and %%system are the only other line+cell magics (I'm not missing any, am I?), so it shouldn't be a problem to implement separate warnings for each.

@jankatins
Copy link
Contributor

I can have a go at the timeit case as part of #2855

@rlmv
Copy link
Contributor

rlmv commented Feb 1, 2013

Oh, sorry @JanSchulz - already stuck it in there.

@rlmv
Copy link
Contributor

rlmv commented Feb 1, 2013

I don't have tests for these since there seems to be a problem with running cell magics in docstring tests. Opening an issue for that...

rlmv added a commit to rlmv/ipython that referenced this issue Feb 5, 2013
Notifies user if they run %%timeit with an empty cell block - see issue ipython#2862.
rlmv added a commit to rlmv/ipython that referenced this issue Feb 5, 2013
Warns the user if they run a %%sx derivative with an empty cell - issue ipython#2862. This is not perfect since, from within sx, there's no way to to tell which of sx/system/! were issued and we have to be generic.
@takluyver
Copy link
Member Author

Closed by PR #2874.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Notifies user if they run %%timeit with an empty cell block - see issue ipython#2862.
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Warns the user if they run a %%sx derivative with an empty cell - issue ipython#2862. This is not perfect since, from within sx, there's no way to to tell which of sx/system/! were issued and we have to be generic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants