[IPython-dev] Should IPython be a singleton?
Wed Aug 26 17:19:47 CDT 2009
> > 1. We muck with sys.excepthook, sys.displayhook, sys.ipcompleter,
> > sys.stdin, sys.stdout
> That doesn't have to be a problem. That's why I wrote all of those *Trap
> classes. And as far as I can tell, sys.ipcompleter is entirely from
> IPython, not
> Python itself. I have no idea why it's in the sys namespace in the first
Yes, your trap classs would help manage all of this for sure. But we have
a long way to go in the core before the mucking with sys is done in a safe
As far as ipcompleter, I haven't tracked down exactly why it is there. But
I do know it is used
from that location in the embedded shell. But, a proper API should fix
> 2. We push a number of thing into __builtin__ that point to the
> specific InteractiveShell:
Could be Trapped, as well.
> > 3. Because of severe cycles in our object graph, an InterativeShell
> > instances can't be
> > garbage collected.
> Or rather, they *are* garbage collected and not __del__eted.
I have spent some time with gc and muppy/pympler and as of right now, it is
not even garbage collected. I create and destroy an InteractiveShell
from python (not IPython) and muppy/gc still list it in the live objects.
I haven't had a change to figure out who the offending ref holder is - there
are dozens of them.
> 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
> 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 choices.
#3 would be really, really desirable, and I think it is feasible.
I agree, I think it will take some time to refactor things in place and get
> Robert Kern
> "I have come to believe that the whole world is an enigma, a harmless
> that is made terrible by our own mad attempt to interpret it as though it
> an underlying truth."
> -- Umberto Eco
> IPython-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev