newbie Q on sdtin word completion

Fredrik Lundh fredrik at
Thu Dec 8 12:15:29 CET 2005

"Bernd" wrote:

> I'm on a Linux env and try to get
> word completion form sdtin done,
> like Perl's
>  $stdin = Complete( "\t: ", @choices );
> What I have so far shows me the directory listing
> on the second hit on TAB and not the list of
> choices on the first like I wanted to have.

your completer function is called with a prefix and an index.  for each
completion request, readline will call this function repeatedly, with in-
creasing indices.  for each call, you should return the corresponding
match, or None if there are no more matches.

the second example on this page might help:


More information about the Python-list mailing list