Tab-completion in tutorial

Peter Otten __peter__ at web.de
Sat Jan 21 08:25:13 EST 2012


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.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /