ipython/ipython — pull request #2695 by anntzer (2012-12-17 10:01:15+00:00)
Title: Key the root modules cache by sys.path entries.

Instead of a single root modules cache, cache in a dict the list of modules
associated with each sys.path entries (except $PWD). On future import
completions, create the list of completions by merging the appropriate cache
entries (while updating the cache if sys.path changed) and adding in the
modules in $PWD as well. This allows the completer to keep up with multiple
Python installations, virtualenvs, etc.

Right now the root modules cache grows indefinitely. It may be worth
implementing a LRU cache, a la functools.lru_cache.

cf #2688.