[IPython-dev] Namespace pollution and a kernel panel

MinRK benjaminrk at gmail.com
Fri Jun 15 16:42:21 EDT 2012


On Fri, Jun 15, 2012 at 1:31 PM, Bob McElrath <bob+ipython at mcelrath.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
> is
> not careful, it's easy to end up with some element of worksheet-state that
> is
> not what you think it is, and end up with garbage results.  This can be
> very
> 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()
> or
> scipy.special.gamma().
>
> This is because I ran ipython --pylab, but it highlights a bigger problem:
> how
> 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
> inspect
> 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
> very
> 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
javascript in a markdown cell) as a test of the recently reorganized
javascript that allows decoupling of execution from cells, based on %whos.

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
> that
> 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
> found
> the most desirable representation, that could be copied/moved to the
> worksheet.
>

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
> by
> the tribe.  If you try it, you will be lonely often, and sometimes
> frightened.
> But no price is too high to pay for the privilege of owning yourself."
>    -- Friedrich Nietzsche
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120615/60bd6d8c/attachment.html>


More information about the IPython-dev mailing list