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


Groups > comp.lang.python > #19187

Re: Tab-completion in tutorial

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!amsnews11.chello.com!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'interpreter.': 0.07; 'python': 0.08; 'added,': 0.09; 'bind': 0.09; 'bug,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'talks': 0.10; 'stored': 0.13; 'startup': 0.15; 'typing': 0.15; 'complete")': 0.16; 'file"': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'wrote:': 0.16; '>>>': 0.18; "doesn't": 0.22; 'from:addr:web.de': 0.23; 'subject:tutorial': 0.23; 'wrong?': 0.23; 'import': 0.27; 'tried': 0.27; "i'm": 0.27; '(you': 0.28; 'example': 0.28; 'explicitly': 0.28; 'seem': 0.29; "i've": 0.31; 'actually': 0.32; 'to:addr:python-list': 0.33; 'character': 0.34; 'header:X-Complaints-To:1': 0.34; 'something': 0.35; 'however,': 0.35; 'file': 0.35; 'url:python': 0.36; 'bound': 0.36; 'but': 0.37; 'received:org': 0.37; 'steven': 0.38; 'think': 0.38; 'url:docs': 0.39; 'url:org': 0.39; 'doing': 0.39; 'expected': 0.39; 'hit': 0.39; 'subject:: ': 0.39; 'change': 0.40; 'to:addr:python.org': 0.40; 'capable': 0.61; 'your': 0.61; 'strange': 0.68; 'anything.': 0.71; 'interference': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Tab-completion in tutorial
Date Sat, 21 Jan 2012 14:25:13 +0100
Organization None
References <4f1a8e48$0$29987$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p508497d8.dip.t-dialin.net
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4906.1327152330.27778.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1327152330 news.xs4all.nl 6912 [2001:888:2000:d::a6]:38156
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19187

Show key headers only | 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