[IPython-user] Detecting interactive mode reliably

Francesc Altet faltet@carabos....
Wed Feb 28 05:17:18 CST 2007


Hi,

I'm trying to discover a way to detect whether the python interpreter
has been called interactively or not. My goal is to avoid costly
initialization calls in case the a program is not run interactively.

To be more specific, I only need to know whether the interpreter has the
readline() features activated or not. If they are (and only in this
case) then I need to preload some attributes on certain classe for easy
interactive introspection (i.e. using the TAB key).

Anyone has a clue on how to do this? (should be valid for Win as well)

Cheers,

-- 
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works, 
www.carabos.com   |  I haven't tested it. -- Donald Knuth



More information about the IPython-user mailing list