auto-completion history

Serge Orlov Serge.Orlov at gmail.com
Fri Feb 25 08:11:54 EST 2005


porterboy wrote:
> Hi Folks,
>
> I have auto-completion set up in my python interpreter so that if I
> hit the tab key it will complete a variable or a python command*. eg.
> if I type
> >>> imp
> and if I then hit the tab key, the interpreter will complete it to...
> >>> import
>
> Now, I also use Matlab at the command line a lot and it has a nice
> additional auto-completion feature, whereby, if you type a few
> letters and hit the up-arrow, it will go back to the last command
> you typed > that began with those letters. If you keep hitting
> up-arrow it will cycle through all the commands you typed beginning
> with these letters. eg. if I type...
>
> Does a feature like this already exist in python???

It's not in python, it's in readline library. To read the documentation
do 'man readline'

readline.parse_and_bind('"\e[A": history-search-backward')

works for me. To find out what your up arrow key sends remove
\e[A and hit on your keyboard Control-v and then up arrow.

  Serge.




More information about the Python-list mailing list