[IPython-dev] magics and metadata

Fernando Perez fperez.net@gmail....
Tue Jun 19 15:10:48 CDT 2012


On Tue, Jun 19, 2012 at 12:05 PM, Jonathan Taylor
<jonathan.taylor@stanford.edu> wrote:
> That's the sort of use case I imagine as well, where a cell magic wants
> to about something to the frontend a little more information about what kind
> of cell it is (in your %%bash example, it would be a code cell for which the
> code_mirror might use bash highlighting instead of python). This seems like
> it could be accomplished with something parallel to "publish_display_data"
> for cell metadata which different frontends can handle differently.

The trick is to find a clean way of expressing this that happens:

1. before execution of the cell. Highlighting isn't very useful by the
time the cell has been run

2. keeping the separation between kernels and notebooks we currently
have.  Keep in mind that the kernel has *no idea* that it's being
called by a notebook, all it knows is that it was given a chunk of
code to run.

This separation is something that we've made very central to our
design and it does make a few things harder, but it also makes many
others possible (such as the transparent access to a kernel from a qt
console or text console for debugging and other tasks).

We may end up reconsidering that in the future, but if we do so, we'll
do it pretty carefully.  This kind of discussion is for me very useful
evidence to accumulate as we think about the design tradeoffs.

Cheers,

f


More information about the IPython-dev mailing list