[IPython-dev] migration issues, embedding latest IPython in another application

MinRK benjaminrk at gmail.com
Wed Aug 15 15:25:38 EDT 2012


On Wed, Aug 15, 2012 at 12:13 PM, Thomas Kluyver <takowl at gmail.com> wrote:

> Hi Matt,
>
> On 15 August 2012 18:15, Matt Anderson <manderso at broadcom.com> wrote:
> > To remedy, should the implementation of this function call
> InteractiveShellEmbed.instance() instead of InteractiveShellEmbed()?
>
> Looking at the code for embed(), it has these three lines:
>
>     global _embedded_shell
>     if _embedded_shell is None:
>         _embedded_shell = InteractiveShellEmbed(**kwargs)
>
> So it's effectively implementing a singleton pattern itself. It looks
> to me like it would make more sense to use the .instance() API that's
> used elsewhere in the code, but I'm not familiar with the reason it
> was originally done a different way.
>

embed was implemented before the singleton stuff came together.  It
probably should use instance(), but doing so has one disadvantage: It would
break the ability to call embed() from within an existing IPython session.
 I don't know if anyone cares about that use case, though.


>
> I think Fernando might be most familiar with that bit of the code.
> He's very busy at the moment, so it might be a few days before he can
> chime in.
>
> Thanks,
> Thomas
> _______________________________________________
> 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/20120815/3218df10/attachment.html>


More information about the IPython-dev mailing list