IDLE and rlcompleter [Was: Re: making the Python case to my dept.]

Michael Hudson mwh21 at
Mon Nov 8 18:00:35 EST 1999

jesse at (Jesse Sweeney) writes:

> On 06 Nov 1999 17:50:23 +0000, Michael Hudson <mwh21 at> wrote:
> [ snip ]
> >``import rlcompleter''!!
> >
> >It makes life *so* much easier, and is the reason I still use the
> >basic interpreter rather than idle.
> >
> >Hmm, implementing completion in idle? It has ``expand word'' but
> >that's not what I want. Would this be easy? Pointers appreciated.
> Coincidentally, I had the same idea just a few days ago, and after a
> bit of tinkering, I came up with two different IDLE extensions. I've
> put the files on the web at
> .
> The first ( attempts to mimic the behaviour of
> readline and rlcompleter in the Python shell, and the second
> ( is a bastard child of rlcompleter and the current
> "Expand Word".


I had to change <Meta-.> to <Meta-period> and then to <Alt-period>
(the latter is probably a misconiguration at this end, but the first
may not be).

I'm very used to some other readline conventions such as Meta-. being
yank-last-arg and C-r being reverse-search-history and some
others. Would these be easy to add to your extension? (I know next to
nothing about Tkinter).

> Obviously, unlike "Expand Word" these only work in the Python shell,
> not in the file-editing windows. (Now that I think about it, this
> would probably be pretty useful in those editing windows, but that
> would take some partial compilation of some sort I suppose, which is
> way too much work for me.)

I think I'd settle for the completions being selected from the words
known to the Python shell, if that helps.

While we're on the subject of idle, is there any easy (preferably one
or two keystrokes) that way to import/reload the module being edited
into the Python shell and bring said shell to the front for instant
interactive play? That'd be übercool.

> To add these to IDLE, put the two files in your IDLE directory, (or
> just the one you want -- I'm flexible!), and add "RLComplete" and
> "AutoComplete" to the list of names in (also in your IDLE
> directory).
> Problems and inconsistencies are documented in the module
> docstrings. Let me know of any bugs.
> 	Cheers, Jesse.

Good work!


More information about the Python-list mailing list