[IPython-dev] test from where a module is imported

Fernando Perez fperez.net at gmail.com
Wed Jul 23 19:28:30 EDT 2014

On Thu, Jul 17, 2014 at 1:19 AM, Johann Rohwer <jr at sun.ac.za> wrote:

> I can think of various hacks on how to achieve this but would like to know
> if
> there is The Right Way (TM) and if so, what it is.

There is no 'right way' to do this, because the question is in a sense
ill-posed, given the design of IPython: any given IPython kernel can be
*simultaneously* connected to a notebook, a Qt console and a text console
(or more than one).

So a python process can't really answer 'am I in a Qt console?', since the
answer can be simultaneously yes, no, or both, and it can change at any
point in time during the life of the process (since clients can connect and



Fernando Perez (@fperez_org; http://fperez.org)
fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
fernando.perez-at-berkeley: contact me here for any direct mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140723/6b4eda8b/attachment.html>

More information about the IPython-dev mailing list