[IPython-user] raw_input buglet?
Fernando Perez
fperez at colorado.edu
Mon Jun 30 15:08:44 CDT 2003
Arnd Baecker wrote:
> Hi Ipythonistas (and in particular Fernando, I fear;-)
>
> when using a raw_input in a programm started from
> IPython with run,
> (e.g. run raw_tst.py for the example programm
> # -- cut here --
> # raw_tst.py
> raw_input("Please type anything and press <enter>")
> # -- cut here --
> )
> After running this a "cursor up" reveals that
> the input done at the raw input shows up in th history.
>
> Actually, this also happens directly at the prompt:
>
> In [5]: raw_input("test: ")
> test: we-will-see-this-again-in-the-history
> Out[5]: 'we-will-see-this-again-in-the-history'
> In [6]: we-will-see-this-again-in-the-history
> (the last lines is after a cursor up ...)
>
> Maybe there is some deeper reason why this is useful;
> personally I find it a bit irritating and sometimes annoying,
> and don't like it that much ;-).
Well, there is a deeper reason for it, but I personally hate it too. The
problem is that _all_ keyboard input is controlled by the readline library, so
the up arrows get the readline history for everything. This annoys me greatly
when for example I have @pdb on and when I'm back in ipython, everything I
typed while debugging in pdb shows up in ipython's prompt.
You'll notice that the exact same problem occurs with a regular python
(non-ipython) interactive prompt.
If there are any readline gurus out there with ideas on how to address this,
I'd love to have a solution. Basically having some reasonably inexpensive
way of giving readline a 'namespace' to work with, so that the ipython prompt
has its own private history. But I have no idea of whether this is even
possible at all.
Best,
f.
More information about the IPython-user
mailing list