[IPython-dev] Detecting ipython notebook on the browser

Tiago Antao tra at popgen.net
Fri May 23 08:11:44 EDT 2014

> There are non way to know that a kernel is run from a notebook, 
> and actually the question does not make sense, to retake example 
> i have already use, it's like a book authors wondering the eye color
> of its reader. 

[Changing context a bit here]

At least in my work flow, it is starting to get more common that
IPython notebooks get "promoted" to modules. ie some piece of code that
was initially ad-hoc, graduates to some abstract function and gets
inside a module.

Another use-case is when one wants to run several instances of a
notebook from the command line(e.g. to run many simulation replicates).
i.e., to use a notebook as a script.

One alternative, of course is just to convert mature/reusable
code from .ipynb to .py.

But another alternative is to use notebooks directly as
scripts/modules. In this view, having a way to understand the
context can be really interesting: in front of the users eyes or as a
re-usable piece of code.

Now, I understand that this is not the original intent of the notebook
and that this is going off-script here. But a vision of things might be
to develop everything inside the notebook. The whole code as ipython

I just note that there is no performance penalty in this vision (after
import the speed would be the same) and the machinery to do this is
already very well documented:


I do understand the argument that this is a bit crazy, but it is a
possible use-case nonetheless.


More information about the IPython-dev mailing list