Auto-completion: why not module name?

Chris Angelico rosuav at gmail.com
Mon Mar 16 12:40:32 EDT 2015


On Tue, Mar 17, 2015 at 3:23 AM, candide <c.candide at laposte.net> 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 :
>
> map( max(
>
> [tested on Ubuntu 12.10]
>
> Is it the expected behaviour ?

Looks to me like it's just doing the normal tab-completion of globals,
rather than having a special case for the 'import' statement. So what
you're talking about here is a feature request:

When the input begins "import ", please can tab-completion enumerate
available modules?

This is a very plausible feature request, but be aware that it will
involve a very costly disk search. Figuring out what modules could be
imported means going through the entire Python module search path,
enumerating .py (and other) files, and that could be a lot slower than
you think.

It might even already be available, but disabled by default (because
of that cost). But someone other than me will be better placed to
answer that.

ChrisA



More information about the Python-list mailing list