[IPython-dev] Line-based frontends - architecture

Mark Voorhies mark.voorhies@ucsf....
Thu Feb 7 15:58:25 CST 2013


On 02/07/2013 01:44 PM, Thomas Kluyver wrote:
> Thinking about the possibility of developing a web console to complement
> the notebook, it struck me that the wire protocol doesn't yet provide for
> line-based frontends to know when the input is complete, to decide whether
> to execute or present another continuation prompt.
>
> With the Qt console, we avoid the issue by running the same input
> transformation machinery in the frontend, but that only works for frontends
> written in Python.
>
> I see three potential solutions to this:
>
> 1. Add a message type to the protocol, by which the frontend can send a
> block of code, and the kernel can indicate whether it is 'finished'.
> 2. Reimplement the logic to determine whether a code block is finished in
> the frontend.
> 3. Leave it up to the user, with separate key combinations for 'execute'
> and 'new line', as it is in the notebook.
>
> I prefer number 1. I think the console-like interaction is valuable enough
> to make 3 undesirable. 2 sounds like a lot of work, especially as we get
> both more frontends and more kernels for different languages, with
> different rules about when a block is complete.
>
> Thoughts?

"1" certainly seems cleanest.
I think that there is room to complement it with "3":
In the default python shell, there is the annoying behavior that
blocks must be followed by an empty line (so that the shell knows
that the block has been closed) and empty lines can't be used in
unindented code (e.g., for style) without triggering execution;
so, leaving the option for the user to distinguish between "next line"
and "send to the kernel" in some shells is still useful (but compatible
with "1").

--Mark

>
> Thanks,
> Thomas
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>




More information about the IPython-dev mailing list