Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'importing': 0.05; 'attribute': 0.07; 'context': 0.07; 'subject:Getting': 0.07; "'.'": 0.09; 'builtin': 0.09; 'filename': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:modules': 0.09; 'jan': 0.12; 'builtins': 0.16; 'filenames,': 0.16; 'globals.': 0.16; 'idle.': 0.16; 'listbox': 0.16; 'mode,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'tab': 0.16; 'url:py': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'module': 0.19; 'typing': 0.19; 'help.': 0.21; 'import': 0.22; 'header:User- Agent:1': 0.23; 'recognize': 0.24; 'math': 0.24; '(or': 0.24; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; 'idea': 0.28; 'correct': 0.29; 'am,': 0.29; 'url:code': 0.29; 'relative': 0.30; 'subject:list': 0.30; "i'm": 0.30; 'code': 0.31; 'another.': 0.31; 'context.': 0.31; "d'aprano": 0.31; 'names.': 0.31; 'steven': 0.31; 'anyone': 0.31; 'subject:all': 0.32; 'everyone': 0.33; 'url:source': 0.33; 'but': 0.35; 'idle': 0.36; 'next': 0.36; 'thanks': 0.36; "i'll": 0.36; 'should': 0.36; 'too': 0.37; 'starting': 0.37; 'to:addr:python- list': 0.38; 'expect': 0.39; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'days': 0.60; 'even': 0.60; 'above,': 0.60; 'show': 0.63; 'name': 0.63; 'offering': 0.63; 'url:p': 0.64; 'situation': 0.65; 'within': 0.65; 'mailbox': 0.68; 'completion': 0.78; "'from'": 0.84; 'completes': 0.84; 'received:fios.verizon.net': 0.84; 'working,': 0.84; 'worth,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Getting a list of all modules Date: Thu, 31 Jul 2014 15:59:13 -0400 References: <53d8a20e$0$29977$c3e8da3$5496439d@news.astraweb.com> <53da1d5a$0$29974$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-71-175-90-87.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <53da1d5a$0$29974$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406836778 news.xs4all.nl 2945 [2001:888:2000:d::a6]:53259 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75437 On 7/31/2014 6:41 AM, Steven D'Aprano wrote: > I'm working on tab completion for module names. I have some alpha-quality > code working, so if I hit TAB after typing "import ma" I get this: > > > py> import ma > macpath macurl2path mailbox mailcap mangle > markupbase math This is an interesting idea for Idle. Idle currently completes names from builtins and, in interactive mode, the current globals. So in the situation above, Idle offers 'map' and 'max' in a listbox with all builtins (and globals). But after '.', it completes attribute names instead and within strings, filenames, starting from the current directory of the user process for relative names. It should not be too hard to recognize 'import' and 'from' instead of or in addition to '.' as context markers. Even just offering stdlib name (or current directory names or . imports) would be a help. Builtin names can never be correct in this context. > For what it's worth, importing "mangle" fails with a SyntaxError. But > that's okay, I don't expect tab completion to only show *valid* > modules :-) > > Over the next few days I'll make an official announcement, but if anyone > wants a sneak-peek, check out: > > http://code.google.com/p/tabhistory/source/browse/tabhistory.py > > > where I have indenting, code completion, filename completion, and module > completion all working to some degree or another. > > Thanks to everyone for their help. -- Terry Jan Reedy