Getting a list of all modules

Roy Smith roy at
Thu Jul 31 13:55:38 CEST 2014

In article <53da1d5a$0$29974$c3e8da3$5496439d at>,
 Steven D'Aprano <steve+comp.lang.python at> 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

That's kind of neat.  What do you do if the same name appears multiple 
places in your path?  It would be useful to call this out.  More than 
once, I've done "import x" and gotten a different x than I expected.  
Those kinds of problems can be tricky to debug.

More information about the Python-list mailing list