Auto-completion: why not module name?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Mar 17 04:10:39 EDT 2015


On Tuesday 17 March 2015 03:23, candide wrote:

> Python 3.4 provides auto-completion facility within a Python console
> embedded in a command line terminal.
> 
> 
> But apparently this facility doesn't allow the user to complete with
> standard module name. For instance, editing the following :
> 
>>>> import ma
> 
> and hitting the TAB key doesn't generate
> 
> math
> 
> as I was expecting but the following strings :


You might like my tab completion and command history module:

http://code.google.com/p/tabhistory/

I've been using it on Linux for about three or four years, and although I
don't promise it is bug-free, it shouldn't blow up your computer :-)

It supports module completion in `import` and `from ... import` statements. 
It even supports module attribute completion if the module is already 
cached.

E.g. if the re module is cached, typing

    from re import ma[TAB}

will compete the "ma" to "match".


By default, the tabhistory module:

* indents at the start of the line
* completes on module names in `import` and `from` statements
* completes on file names inside strings
* and completes on global and builtin names and keywords everywhere else.


You can read an announcement here:

http://code.activestate.com/lists/python-list/672898/


Feedback from Mac and Windows users is very, very welcome.





-- 
Steve




More information about the Python-list mailing list