[IPython-dev] Namespace pollution and a kernel panel
Fri Jun 15 15:42:21 CDT 2012
On Fri, Jun 15, 2012 at 1:31 PM, Bob McElrath <firstname.lastname@example.org>wrote:
> One of my long-standing complaints about notebook-style worksheets (Maple,
> Mathematica) is the large and hidden namespace of defined symbols. If one
> not careful, it's easy to end up with some element of worksheet-state that
> not what you think it is, and end up with garbage results. This can be
> difficult to track down. And because worksheets are generally not
> executed top
> to bottom, it often results in difficult-to-reproduce errors.
> I discovered this today with IPython's notebook and gamma(), which turns
> out to
> be numpy.random.gamma() rather than the Euler Gamma function math.gamma()
> This is because I ran ipython --pylab, but it highlights a bigger problem:
> does the user know which symbols are defined? I have been thinking lately
> of an
> addition to the notebook interface: a side-panel showing everything
> defined/imported in the kernel. This would further allow the user to
> the output of commands by clicking on kernel data structures, rather than
> wasting a cell just to print some output. Personally I always end up with
> messy worksheets, because I insert a lot of print or plot commands, just to
> explore a data structure or function.
This is a popular idea - a namespace view, sidebar, etc. a la matlab or
what have you. I've even implemented a simple one myself (purely with
It's not difficult, and should probably be done as a widget-style thing.
> Another possible use of such a thing would be a non-modifying cell: a cell
> refuses to change the state of the kernel by modifying variables, but
> could be
> used to print/plot/explore existing data structures. Then when one has
> the most desirable representation, that could be copied/moved to the
If you want to execute without editing the document,
this is what the 'run-in-place' (ctrl-Enter) is for - running a few
commands in place,
always overwriting the same cell,
because you don't actually want to keep the effects in your document.
> Perhaps there are other creative ways to avoid the user having to manage an
> approximation of the kernel state in their head.
> Cheers, Bob McElrath
> "The individual has always had to struggle to keep from being overwhelmed
> the tribe. If you try it, you will be lonely often, and sometimes
> But no price is too high to pay for the privilege of owning yourself."
> -- Friedrich Nietzsche
> IPython-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev