[Python-Dev] auto-import rlcompleter instead of readline?

Greg Ward gward@python.net
Fri, 23 Mar 2001 10:04:07 -0500


On 22 March 2001, Flying Cougar Burnette said:
> Can anyone think of a good reason why we don't import rlcompleter
> instead of readline by default?  I can give you a good reason why it
> *should*, but I'd rather not bore anyone with the details if I don't
> have to.

Haven't tried your patch, but when you "import rlcompleter" manually in
an interactive session, that's not enough.  You also have to call

  readline.parse_and_bind("tab: complete")

*Then* <tab> does the right thing (ie. completion in the interpreter's
global namespace).  I like it, but I'll bet Guido won't because you can
always do this:

  $ cat > ~/.pythonrc
  import readline, rlcompleter
  readline.parse_and_bind("tab: complete")

and put "export PYTHONSTARTUP=~/.pythonrc" in your ~/.profile (or
whatever) to achieve the same effect.

But I think having this convenience built-in for free would be a very
nice thing.  I used Python for over a year before I found out about
PYTHONSTARTUP, and it was another year after that that I learnedabout
readline.parse_and_bind().  Why not save future newbies the bother?

        Greg
-- 
Greg Ward - Linux nerd                                  gward@python.net
http://starship.python.net/~gward/
Animals can be driven crazy by placing too many in too small a pen. 
Homo sapiens is the only animal that voluntarily does this to himself.