Currently, IPython is not a singleton, but effectively it is. We do a number of things that essentially prevent<br>multiple InteractiveShells from being created:<br><br>1. We muck with sys.excepthook, sys.displayhook, sys.ipcompleter, sys.stdin, sys.stdout<br>
<br>2. We push a number of thing into __builtin__ that point to the specific InteractiveShell:<br><br>__IPYTHON__<br>exit<br>quit<br>reload<br><br>3. Because of severe cycles in our object graph, an InterativeShell instances can't be<br>
garbage collected.<br><br>So, should we actually make InteractiveShell a singleton? There are a couple of different<br>options:<br><br>1. One InteractiveShell per process - a true singleton.<br>2. One InteractiveShell at a time, but multiple (serial) ones in a process.<br>
3. Multiple, sumultanous InteractiveShells<br><br>The only subtlety is that some level of nesting is possible.<br><br>Just a note: it will take a lot of refactoring to really implement any of the above options.<br>But, I want to know what we are aiming for as this issue affects many design choices.<br>
<br>Cheers,<br><br>Brian<br>