You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but with ~70 instead of 3
which generated 70 code cell with just x= range in it...
it was really painfull to clean, it would be nice to prevent something like that
Ah, that's from a convenience I added for the console - if you do x=range?, it will show the help and put x=range at the next prompt so you can keep typing. It seems the notebook interprets that as making a new cell.
That 'next prompt' action probably shouldn't happen for multiline cells. It should probably also be disabled for the notebook, but I don't know how much the kernel knows about the frontend it's talking to.
this goes back to the IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input function. It is being called on each iteration of the loop with the string: " x=range?"
What is this function for and any is it called each time ? is triggered? I did a quick grin and this set_next_input is called throughout the codebase. The notebook current creates a new cell with the contents of the payload. I didn't add any of this code, but would like to understand the logic behind all of this. @fperez, @minrk ?
This is how things like %loadpy work, for initializing the contents of the next input (cell). It should probably be implemented in a way that multiple calls within a single cell only result in one actual event. The most logical model is probably for each call to clobber the previous one, so that only the last call within a given execution actually has an effect.
This is how things like %loadpy work, for initializing the contents of the next input (cell). It should probably be implemented in a way that multiple calls within a single cell only result in one actual event. The most logical model is probably for each call to clobber the previous one, so that only the last call within a given execution actually has an effect.
Reply to this email directly or view it on GitHub: #1349 (comment)
Min's suggestion sounds sensible - this is how the terminal and the Qt console already work: set_next_cell sets an internal value, which is read when we produce the next prompt. I'll look into it, but it will be tomorrow, so if anyone else wants to take a crack at it in the meantime, go for it.
Activity
takluyver commentedon Jan 30, 2012
Ah, that's from a convenience I added for the console - if you do
x=range?, it will show the help and putx=rangeat the next prompt so you can keep typing. It seems the notebook interprets that as making a new cell.That 'next prompt' action probably shouldn't happen for multiline cells. It should probably also be disabled for the notebook, but I don't know how much the kernel knows about the frontend it's talking to.
Carreau commentedon Jan 30, 2012
Does the
%loadpyfunction also use next_prompt ?takluyver commentedon Jan 30, 2012
Yes, I believe it does.
ellisonbg commentedon Jan 31, 2012
this goes back to the IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input function. It is being called on each iteration of the loop with the string: " x=range?"
What is this function for and any is it called each time ? is triggered? I did a quick grin and this set_next_input is called throughout the codebase. The notebook current creates a new cell with the contents of the payload. I didn't add any of this code, but would like to understand the logic behind all of this. @fperez, @minrk ?
minrk commentedon Jan 31, 2012
This is how things like
%loadpywork, for initializing the contents of the next input (cell). It should probably be implemented in a way that multiple calls within a single cell only result in one actual event. The most logical model is probably for each call to clobber the previous one, so that only the last call within a given execution actually has an effect.ellisonbg commentedon Jan 31, 2012
OK, so this sounds like an issue with set_next_input itself, not the
notebook. @takluyver can you investigate?
On Mon, Jan 30, 2012 at 4:29 PM, Min RK
[email protected]
wrote:
Brian E. Granger
Cal Poly State University, San Luis Obispo
[email protected] and [email protected]
takluyver commentedon Jan 31, 2012
Min's suggestion sounds sensible - this is how the terminal and the Qt console already work: set_next_cell sets an internal value, which is read when we produce the next prompt. I'll look into it, but it will be tomorrow, so if anyone else wants to take a crack at it in the meantime, go for it.
set_next_input: squash multiple calls from the same cell execution
Add regression test for ipython#1349