Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87574

Re: Auto-completion: why not module name?

References <18705a55-6b0a-4b55-99ab-479c19566e1a@googlegroups.com>
Date 2015-03-17 03:40 +1100
Subject Re: Auto-completion: why not module name?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.451.1426524036.21433.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Mar 17, 2015 at 3:23 AM, candide <c.candide@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Auto-completion: why not module name? candide <c.candide@laposte.net> - 2015-03-16 09:23 -0700
  Re: Auto-completion: why not module name? Chris Angelico <rosuav@gmail.com> - 2015-03-17 03:40 +1100
  Re: Auto-completion: why not module name? Jonas Wielicki <jonas@wielicki.name> - 2015-03-16 17:54 +0100
  Re: Auto-completion: why not module name? Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-16 10:57 -0600
  Re: Auto-completion: why not module name? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-17 19:10 +1100
    Re: Auto-completion: why not module name? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-03-17 12:22 +0000
      Re: Auto-completion: why not module name? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-18 09:54 +1100
  Auto-completion of Unicode names [was why not module name?] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-18 10:29 +1100
    Re: Auto-completion of Unicode names [was why not module name?] Chris Angelico <rosuav@gmail.com> - 2015-03-18 11:06 +1100
    Re: Auto-completion of Unicode names [was why not module name?] Dan Sommers <dan@tombstonezero.net> - 2015-03-18 01:07 +0000

csiph-web