readline, rlcompleter

python MrJean1 at gmail.com
Tue Jan 11 20:48:00 EST 2005


There is a pretty complete (no pun intended) example in the standard
cmd module

<http://docs.python.org/lib/module-cmd.html>

Check file cmd.py in your Python installation .../lib/pythonX.Y/cmd.py,
specifically the methods Cmd.preloop() and Cmd.complete().

Another, more elaborate example is in PySH at

<http://unixnaut.com/skills/Languages/python/pysh.py>


/Jean Brouwers

PS) A version of readline for Windows is here

<http://newcenturycomputers.net/projects/readline.html>



michele.simionato at gmail.com wrote:
> This a case where the documentation is lacking. The standard library
> documentation
> (http://www.python.org/dev/doc/devel/lib/module-rlcompleter.html)
gives
> this example
> try:
> import readline
> except ImportError:
> print "Module readline not available."
> else:
> import rlcompleter
> readline.parse_and_bind("tab: complete")
>
> but I don't find a list of recognized key bindings. For instance, can
I
> would like to bind shift-tab to rlcompleter, is that possible? Can I
use
> function keys? I did various attempt, but I did not succed :-(
> Is there any readline-guru here with some good pointers?
> Michele Simionato




More information about the Python-list mailing list