I realised that I have a fairly large ~/.pythonrc.py
, notably helping with pretty printing and tab-completion.
But I'm now using ipython
a lot and some of the commands executed in .pythonrc.py
are annoying me and slowing it down at launch.
Instead of deleting the file or commenting it out, the better would be that I execute the script conditionally depending on whether I launch python
or ipython
.
How can I do that?
How to detect the launching script from inside .pythonrc.py
?
NB: sys.argv
is not helping when used in .pythonrc.py