[IPython-dev] notebook %magic

Thomas Kluyver takowl at gmail.com
Thu May 31 16:49:02 EDT 2012


On 31 May 2012 21:32, Ralf Hemmecke <hemmecke at gmail.com> wrote:
> Anyway, if the ipython notebook should some day be able to be used as a
> frontend for maple or mathematica then %, %% and %%% are bad, because of
> their meaning inside the respective system.

As far as I know, the notebook itself doesn't know about the escape
sequences - that's all processed in the kernel. A hypothetical maple
or mathematica kernel wouldn't process ipython escape sequences, so it
shouldn't be an issue.

> Of course, I don't yet know the source code, but why wouldn't it be a
> feasible way to start the notebook code with something like
>
> escapesequence='%
>
> escaperegex='%\

It's *feasible*, but not practical, because we've written the code
with the assumption that the escape character is not configurable, and
we've got enough to do at the moment without introducing the extra
complexity to make it easy to change.

If I remember the history right, magic functions were originally @foo,
but then Python gained decorators using @, so magic functions were
changed to %foo.

Best wishes,
Thomas



More information about the IPython-dev mailing list