[IPython-User] output of multiple statements?

Zoltán Vörös zvoros@gmail....
Sun Jan 22 14:21:37 CST 2012


Hi All,

I would like to ask a very general question about how ipython works. 
Namely, it seems to me that when multiple statements are executed, only 
the last one's output is displayed. This was most probably not an issue 
in the console, because one would, most of the time, have a single 
statement per line. However, in the notebooks, the situation is 
completely different (for the better, mind you!), because one could 
execute two statements with a single "Enter" or "Shift+Enter", but only 
the last valid statement produces an output.
An example:

range(4)
range(5)

will print only [0, 1, 2, 3, 4]. By the way, this would also happen in 
the console, if I did this
range(4); range(5)

I know, I know, we are strongly discouraged from doing this. I only 
wanted to demonstrate the issue;)

Now, my question is whether this has been considered, or there is a very 
fundamental reason for not changing this, even in the multiline 
qtconsole or the notebook. I can very well imagine that it might not be 
trivial to sort out the outputs of all statements, and then one just 
waits for the last one...
Cheers,
Zoltán


More information about the IPython-User mailing list