[IPython-dev] messaging protocol

Fernando Perez fperez.net at gmail.com
Fri Apr 8 16:32:49 EDT 2011

On Fri, Apr 8, 2011 at 1:21 PM, Thomas Kluyver <takowl at gmail.com> wrote:
> In fact, now that we're using AST instead of code blocks, we could actually
> do what you suggest. We could check the last node, and only run it
> interactively if it was a single expression. Whether or not that's what we
> want to do, I don't know: any views?

That's a very good point.  The fragile heuristics we had were
precisely because we lacked this information.  But I really do like
this suggestion, because I think it provides the most intuitive
semantics.  Things like:

for i in range(10):

won't produce 10 different Out[] outputs, and yet any last-block
expression, even if it contains some multline string or other complex
formatting that makes it be more than one *line of text* will still be
executed interactively, yielding just one result.

I'm very much +1 on this idea.  Big benefit of your recent tackling
inputsplitter!! Awesome.


More information about the IPython-dev mailing list