i.e. can you do something like:
if we_are_in_ipython:
do_some_ipython_specific_stuff()
normal_python_stuff()
I guess what I'm trying to do is very loosely along the lines of #if DEBUG
in C# (i.e. using ipython as a debugging tool and command line python to run the code without the debugging stuff in there).