ipython/ipython — pull request #2690 by bfroehle (2012-12-17 01:57:04+00:00)
Title: Fix 'import '... completion for py3 & egg files.

In Python 3, extension modules often have a suffix like `.cpython-32mu.so` which the current `import ` mechanism cannot handle. In addition, the module list completion is broken for `.egg` files (i.e., zip files).

I propose replacing the current `module_list(path)` mechanism with the following algorithm:

1. Build a list of files.
a. If path is a directory, build a list of all files in the directory and all files in its subdirectories. (For performance reasons, recurse only one level.)
b. If the path is a zip file, use zipimporter to get a list of files in the directory.

2. Use a regular expression to identify importable modules & packages from the list of files.

Closes #2555.