rlcompleter — 用于 GNU readline 的补全函数

源代码: Lib/rlcompleter.py


The rlcompleter module defines a completion function suitable to be passed to set_completer() readline 模块。

When this module is imported on a Unix platform with the readline module available, an instance of the Completer class is automatically created and its complete() 方法会被设为 readline completer . The method provides completion of valid Python identifiers and keywords .

范例:

>>> import rlcompleter
>>> import readline
>>> readline.parse_and_bind("tab: complete")
>>> readline. <TAB PRESSED>
readline.__doc__          readline.get_line_buffer(  readline.read_init_file(
readline.__file__         readline.insert_text(      readline.set_completer(
readline.__name__         readline.parse_and_bind(
>>> readline.