[IPython-dev] cell magics

Fernando Perez fperez.net at gmail.com
Sat Feb 16 13:48:54 EST 2013

On Sat, Feb 16, 2013 at 7:52 AM, Thomas Kluyver <takowl at gmail.com> wrote:

> - After the development of the notebook, magics were extended to include
> cell magics,

It's important to know that this is a perfect example of correlation
not being causation: we could have added the cell magics once we had
the qtconsole, we just didn't have the time/resources for it.  All
that's needed for cell magics to make sense is a practical multi-line
client, which we only had once the qt console was functional.

It was only when Chris Kees and Jose Unpingco worked with us to get
DoD funding that we had the bandwidth to dig deeper into the magic
system to overhaul it, and in the process, add the cell magics.

I mention this because it's important to clarify that they have
nothing to do with the notebook as a client: the magic system is part
of the core of ipython, that is available to *all* clients, even the
plain terminal.  Obviously in a line terminal it's pretty miserable to
use any non-trivial cell magic, but you can do so if you really want:

In [1]: %%bash
   ...: echo hi

> Arguably, the newer uses don't have to fit into the same scheme as the
> original command-like magics. But neither do they have to be separate, and I
> think we're better off supporting one flexible scheme than adding a second,
> incompatible scheme for cell magics.




More information about the IPython-dev mailing list