[IPython-dev] notebook %magic

Fernando Perez fperez.net at gmail.com
Thu May 31 14:43:24 EDT 2012


On Thu, May 31, 2012 at 11:15 AM, Brian Granger <ellisonbg at gmail.com> wrote:
>> 1) Is there a way to change the magic prefix from % to something user
>> defined? It would be OK for me if this is done at startup of the
>> notebook. I'm not sure for the ipython notebook, but I remember that in
>> the sage-notebook the % prefix was actually stored inside the notebook
>> itself without having a global setting at the beginning of the notebook
>> to set this prefix character.
>
> Because of how we implement magics in the kernel, this would not be possible.


A bit more detail: that logic is delicate enough that in the recent
big magics refactoring, I made the explicit decision to punt and
hardcode '%%' as the cell magic prefix.  While one *could* in
principle make the magic escapes configurable, there's a LOT of code
in IPython by now where that is hardcoded, including multiple delicate
regular expressions that are used on every single line of input.

I simply don't think it's realistic right now to make that configurable.

Cheers,

f



More information about the IPython-dev mailing list