# Readline completion of everything :)
import rlcompleter, readline, atexit
-defaultCompleter = rlcompleter.Completer()
+default_completer = rlcompleter.Completer()
-historyPath = os.path.expanduser("~/.pyhistory")
+history_path = os.path.expanduser("~/.python_history")
-def myCompleter(text, state):
+def my_completer(text, state):
if text.strip() == "":
if state == 0:
return text + "\t"
else:
return None
else:
- return defaultCompleter.complete(text, state)
+ return default_completer.complete(text, state)
-def save_history(historyPath=historyPath):
+def save_history(history_path=history_path):
import readline
- readline.write_history_file(historyPath)
+ readline.write_history_file(history_path)
-readline.set_completer(myCompleter)
+readline.set_completer(my_completer)
readline.parse_and_bind("tab: complete")
-if os.path.exists(historyPath):
- readline.read_history_file(historyPath)
+if os.path.exists(history_path):
+ readline.read_history_file(history_path)
atexit.register(save_history)