Getting a list of all modules

Chris Angelico rosuav at
Thu Jul 31 15:13:37 CEST 2014

On Thu, Jul 31, 2014 at 9:55 PM, Roy Smith <roy at> wrote:
> 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.

Immaterial to the tab completion, as it just means one of them is
shadowed by the other. But yes, that could be extremely useful - or
maybe completely useless, if there's a lot of intentional shadowing
happening. At any rate, it'd be nice to be able to say "Show me
everything that could be found for this name", which the same code
could answer.


More information about the Python-list mailing list