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


Groups > comp.lang.python > #19185 > unrolled thread

Tab-completion in tutorial

Started bySteven D'Aprano <steve+comp.lang.python@pearwood.info>
First post2012-01-21 10:07 +0000
Last post2012-01-21 14:25 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  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

#19185 — Tab-completion in tutorial

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-01-21 10:07 +0000
SubjectTab-completion in tutorial
Message-ID<4f1a8e48$0$29987$c3e8da3$5496439d@news.astraweb.com>
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?



-- 
Steven

[toc] | [next] | [standalone]


#19187

FromPeter Otten <__peter__@web.de>
Date2012-01-21 14:25 +0100
Message-ID<mailman.4906.1327152330.27778.python-list@python.org>
In reply to#19185
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web