[IPython-user] Prompt

Fernando Perez Fernando.Perez at colorado.edu
Tue Mar 15 14:58:06 CST 2005


Ville Vainio wrote:
> On Tue, 2005-03-08 at 17:29 +0100, Frédéric Mantegazza wrote:
> 
> 
>>I would like to know if it is possible to dynamically modify the prompt ? I 
>>tried to modified __IP.rc.prompt_in1, and __IP.shell.rc.prompt_in1, but it 
>>does not work...
> 
> 
> Dunno. But now that we are talking about prompts, it might be a good
> idea to create the prompt via the new "hooks" system to yield a totally
> customizable prompt experience...

Well, the prompt _strings_ are customizable.  As far as the objects 
themselves, that's a different story: the prompt objects in ipython have way 
too much responsibility for interacting with core functionality, to be easily 
modifiable (esp. _safely_).

What could be done, if people _really_ need a more dynamic prompt, would be to 
provide a way to re-initialize the prompt string if rc.prompt* change.  That 
is feasible, though I won't do it just for the sake of it: if anyone can give 
me a real-world usage case where the current system (startup-only access to 
the prompt string) is too limiting, I'll look into it, and think of the 
cleanest way to expose this functionality to users.  It's a matter of simply 
calling again the initialization machinery at runtime, and a bit of 
refactoring of the relevant pieces should do the trick.

Best,

f




More information about the IPython-user mailing list