[IPython-User] output of multiple statements?
Sun Jan 22 15:44:37 CST 2012
2012/1/22 Zoltán Vörös <email@example.com>
> 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;)
The code that decides what to display uses the Abstract Syntax Tree, so it
doesn't differentiate this from separate lines: in both cases, you have two
> 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...
It's easy enough to display them all if we decide we want to, but I don't
think it's necessarily what we want. Lots of functions you invoke for their
side effects may return a value that you're not interested in seeing (for
instance, in Python 3, writing to a file returns the number of bytes
written). I think having one input cell to one item of output keeps it
clear what's going on. You can of course use print to produce extra output.
If you're interested, the code that decides what will get displayed is in
(code compiled in 'single' mode triggers the displayhook)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User