python-shell-completion-setup-code
python-shell-completion-setup-code is a variable defined in `
python.el
'.
Its value is
"try:\n import __builtin__\nexcept ImportError:\n # Python 3\n import builtins as __builtin__\ntry:\n import readline, rlcompleter\nexcept:\n def __PYTHON_EL_get_completions(text):\n return []\nelse:\n def __PYTHON_EL_get_completions(text):\n builtins = dir(__builtin__)\n completions = []\n try:\n splits = text.split()\n is_module = splits and splits[0] in ('from', 'import')\n is_ipython = ('__IPYTHON__' in builtins or\n '__IPYTHON__active' in builtins)\n if is_module:\n from IPython.core.completerlib import module_completion\n completions = module_completion(text.strip())\n elif is_ipython and '__IP' in builtins:\n completions = __IP.complete(text)\n elif is_ipython and 'get_ipython' in builtins:\n completions = get_ipython().Completer.all_completions(text)\n else:\n i = 0\n while True:\n res = readline.get_completer()(text, i)\n if not res:\n break\n i += 1\n completions.append(res)\n except:\n pass\n return completions"
Documentation:
Code used to setup completion in inferior Python processes.
You can customize this variable.