Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:not': 0.03; '16,': 0.03; 'completeness': 0.07; 'imported': 0.09; 'subject:module': 0.09; 'api': 0.11; 'python': 0.11; '.py': 0.16; 'finder': 0.16; 'finders': 0.16; 'foo.': 0.16; 'other)': 0.16; 'statement.': 0.16; 'think.': 0.16; 'wrote:': 0.18; 'module': 0.19; 'packages.': 0.19; 'input': 0.22; 'import': 0.22; 'issue.': 0.22; 'network,': 0.22; 'mon,': 0.24; 'looks': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'feature': 0.29; 'am,': 0.29; 'generally': 0.29; 'message-id:@mail.gmail.com': 0.30; 'request,': 0.31; 'search.': 0.31; 'file': 0.32; 'another': 0.32; 'could': 0.34; "can't": 0.35; 'requirement': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'disk': 0.36; 'doing': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'entire': 0.61; "you're": 0.61; "you've": 0.63; 'talking': 0.65; 'here': 0.66; 'mar': 0.68; 'difficulty': 0.68; 'special': 0.74; '2015': 0.84; 'costly': 0.84; 'request:': 0.91; 'subject:Auto': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=v992ySqwv12y4r7sAwXa6a1hpzZ8Kiv9UuLrChzB8po=; b=TqeBX7kc/hJ+p0/+ojrtuhoKYwiZ07jR5EyVjWntUvM50lEhCARqwiV/piTtXvWspF +XReu1NtDmxuNin/jMjSajs4bdCP+pJG54eadI+WhE9oW7vbSQaAp5CFcFGspq6eqlgS uB0JrGyXtOz3it+qV1SGi/yMKuhYamhqXor+tALNGtdRV8jKen2REKh6AeFU0X4ptL2l WVifHqGIzfXJPz5RYsctikrTOVjC2R+yw5YlU2BGmfL7OHGoxIkZO1F4WmgAhydwluXA I9xCwH3LuNF1R3rlnKbeRIeG2buGjzTkI4xrPy2mNAjHFIziPtjOS8NKw0t+++XOwyMN fjHw== X-Received: by 10.66.136.48 with SMTP id px16mr103408263pab.89.1426525080585; Mon, 16 Mar 2015 09:58:00 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <18705a55-6b0a-4b55-99ab-479c19566e1a@googlegroups.com> From: Ian Kelly Date: Mon, 16 Mar 2015 10:57:20 -0600 Subject: Re: Auto-completion: why not module name? To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1426525083 news.xs4all.nl 2892 [2001:888:2000:d::a6]:46682 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:87576 On Mon, Mar 16, 2015 at 10:40 AM, Chris Angelico wrote: > 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. Completeness would also be an issue. There is no general requirement that module finders use the file system at all (one could write a finder and loader to import modules from the network, for instance), nor is there any API for enumerating the modules available. Another difficulty would be packages. You can't generally know whether foo.bar is a module until you've already imported foo.