[IPython-dev] Re: Changes to Notebook Format
Fernando.Perez at colorado.edu
Wed Jul 27 00:44:40 CDT 2005
Robert Kern wrote:
> Tzanko Matev wrote:
>>I found other problems with the current format. It is entirely possible
>>that a single input has several outputs, and prints to stdout and/or
>>stderr several times. Take for examlpe the following code.
>>In : if True:
>> ...: 1
>> ...: print 'foo'
>> ...: 2
>> ...: print 'bar'
> I've never run into a case where I actually want to see multiple
> Out's. It's usually in the middle of a for loop and I've forgotten
> that a function returns an object that I don't really need to see (e.g.
> pylab.plot()). Since only the last one actually goes into the output
> cache (that is, is accessible for later use via Out), I'm not
> convinced that printing multiple Out's is useful. If I really want to
> see something in the middle of a loop, I'll print it.
Here's an even worse example:
In : for i in range(3):
...: print 'passing...'
The multiple Out behavior is really mostly an implementation accident, not a
design feature. I'd be willing to consider it a bug, in the sense that naked
expressions in compound statements should not really be treated as return
valuues. I think the example above should simply print 'passing...' three
times, and NOT generate an Out cell at all.
> As for having stdout cells interleaved with other types of output cells,
> I think that's going to be pretty hard. You'd have to collect the output
> from each statement separately. I'm of the opinion that you should just
> collect one each of stdout and stderr.
More information about the IPython-dev