[IPython-dev] test from where a module is imported
Johann Rohwer
jr at sun.ac.za
Wed Jul 16 10:19:06 EDT 2014
Hi all,
Say I'm developing a Python module and would like to know from where the user
imports this module, i.e. from a regular Python shell, an IPython shell, an
IPython qtconsole, or an IPython notebook. I would like to enable additional
features in my module depending on e.g. useful stuff that is available in the
notebook. But I want the module also to be able to be imported and run in any
of the other environments, so it's really more like a test from where we are
imported.
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.
Thanks,
Johann
The integrity and confidentiality of this email is governed by these terms / Hierdie terme bepaal die integriteit en vertroulikheid van hierdie epos. http://www.sun.ac.za/emaildisclaimer
More information about the IPython-dev
mailing list