Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19187

Re: Tab-completion in tutorial

From Peter Otten <__peter__@web.de>
Subject Re: Tab-completion in tutorial
Date 2012-01-21 14:25 +0100
Organization None
References <4f1a8e48$0$29987$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.4906.1327152330.27778.python-list@python.org> (permalink)

Show all headers | View raw


Steven D'Aprano wrote:

> I'm reading the part of the tutorial that talks about tab-completion, and
> I think the docs are wrong.
> 
> http://docs.python.org/tutorial/interactive.html#key-bindings
> 
> The "more capable startup file" example given claims:
> 
> # Add auto-completion and a stored history file of commands to your Python
> # interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
> # bound to the Esc key by default (you can change it - see readline docs).
> 
> but I have tried it, and it doesn't seem to actually bind autocomplete to
> anything.
> 
> Is this a documentation bug, or am I doing something wrong?

I've just tried it on Kubuntu's konsole. I see strange reactions:
After typing "imp" I have to hit ESC three times before "ort" is added, and 
afterwards a character is swallowed. However, I can get the expected 
behaviour after binding the key explicitly with

>>> import readline
>>> readline.parse_and_bind("esc: complete")

I'm not sure whether Python is to blame or Ubuntu; it may be an interference 
with konsole's key bindings.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Tab-completion in tutorial Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-21 10:07 +0000
  Re: Tab-completion in tutorial Peter Otten <__peter__@web.de> - 2012-01-21 14:25 +0100

csiph-web