Comment 2 for bug 512826

Revision history for this message
Roald de Vries (ipython) wrote :

Clearly, becauses sys.ps{1,2} is part of the python definition, not every valid python program runs well on ipython. But, I admit, not many will have problems with this in practice.

A practical problem is this: I have a script that I want to use in 2 ways:
- for running from bash with command line arguments (subcommands); it executes the subcommands and exits
- for starting an interactive session in ipython

The script should check whether it is interactive or not, an in case it is, it should make available some functions and 'aliases'. The best (only?) way to find this out (for non-ipython-python) seems to be whether sys.ps{1,2} is defined or not.

I think it would be elegant if the ipython prompt mechanism could be made consistent with the sys.ps{1,2} mechanism.