diff --git a/docs/source/whatsnew/version1.0.txt b/docs/source/whatsnew/version1.0.txt index f48f43e..e9145b6 100644 --- a/docs/source/whatsnew/version1.0.txt +++ b/docs/source/whatsnew/version1.0.txt @@ -70,7 +70,17 @@ We also have added: Which is a *library* function for getting the current IPython instance, and will return ``None`` if no IPython instance is running. This is the official way to check whether your code is called from inside an IPython session. +If you want to check for IPython without unnecessarily importing IPython, +use this function: +.. sourcecode:: python + + def get_ipython(): + """return IPython instance if there is one, None otherwise""" + import sys + if "IPython" in sys.modules: + import IPython + return IPython.get_ipython() Core ----