[Python-Dev] a quit that actually quits

Fernando Perez fperez.net at gmail.com
Fri Dec 30 06:53:50 CET 2005


Nick Coghlan wrote:

> As Fernando pointed out, anything else means we'd be well on our way to
> re-inventing IPython (although I'd be interested to know if sys.inputhook
> would have made IPython easier to write).

[sorry if this drifts off-topic for python-dev.  I'll try to provide useful info
on interactive computing in python here, and will gladly answer further
detailed discussion about ipython on the ipython-dev/user lists ]

In my case, I don't think it would have made that much of a difference in the
end, though initially it might have been tempting to use it.  IPython started
as my private collection of sys.ps{1,2} + sys.displayhook hacks in
$PYTHONSTARTUP.  I then discovered LazyPython, which had a great
sys.excepthook, and IPP, which was a full-blown derivative of
code.InteractiveConsole.  I decided to join all three projects, and thus was
ipython born.  Given that IPP was the 'architecture', from the moment we had
what is still today's ipython, it was based on code.InteractiveConsole, and at
that point I doubt that having sys.inputhook would have mattered.

Incidentally, just two days ago I removed the last connection to code.py: at
this point I had overridden so many methods, that there was no point in keeping
the inheritance relationship.  All I had to do was copy _two_ remaining
methods, and the main ipython class became standalone (this frees me for
ongoing redesign work, so it was worth doing it).

So in summary, while sys.inputhook would make it easy to do _lightweight_
interactive customizations, if you really want a more sophisticated and
featureful system, it probably won't matter.

Note that this is not an argument against sys.inputhook: exposing
customizability here may indeed be useful.  This will allow people to write,
with minimal effort, systems which pre-process special syntaxes and ride on top
of the python engine.  IPython exposes the exact same thing as a customizable
hook (called prefilter), and people have made some excellent use of this
capability.  The most notable one is SAGE:

http://modular.ucsd.edu/sage

a system for interactive mathematical computing (NSF funded).  If anyone is in
the San Diego area, the first SAGE meeting is in February:

http://modular.ucsd.edu/sage/days1/

and I'll be giving a talk there about ipython, including some of its design and
my plans for a more ambitious system for interactive computing (including
distributed computing) based on Python.  The prototypes of what we've done so
far are briefly described here (the first was funded by Google as a summer of
code project):

http://ipython.scipy.org/misc/ipython-notebooks-scipy05.pdf
http://ipython.scipy.org/misc/scipy05-parallel.pdf

I hope this is of some use and interest.

Regards,

f



More information about the Python-Dev mailing list