[IPython-dev] Should IPython be a singleton?

Brian Granger ellisonbg.net at gmail.com
Wed Aug 26 17:36:39 EDT 2009

Currently, IPython is not a singleton, but effectively it is.  We do a
number of things that essentially prevent
multiple InteractiveShells from being created:

1.  We muck with sys.excepthook, sys.displayhook, sys.ipcompleter,
sys.stdin, sys.stdout

2.  We push a number of thing into __builtin__ that point to the specific


3.  Because of severe cycles in our object graph, an InterativeShell
instances can't be
garbage collected.

So, should we actually make InteractiveShell a singleton?  There are a
couple of different

1.  One InteractiveShell per process - a true singleton.
2.  One InteractiveShell at a time, but multiple (serial) ones in a process.
3.  Multiple, sumultanous InteractiveShells

The only subtlety is that some level of nesting is possible.

Just a note: it will take a lot of refactoring to really implement any of
the above options.
But, I want to know what we are aiming for as this issue affects many design


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090826/55df48a2/attachment.html>

More information about the IPython-dev mailing list