]>
code.delx.au - dotfiles/blob - .pythonrc.py
3 # Useful things to have
4 from __future__
import division
13 from datetime
import datetime
, timedelta
25 # Readline completion of everything :)
26 import rlcompleter
, readline
, atexit
27 defaultCompleter
= rlcompleter
.Completer()
29 historyPath
= os
.path
.expanduser("~/.pyhistory")
31 def myCompleter(text
, state
):
32 if text
.strip() == "":
38 return defaultCompleter
.complete(text
, state
)
40 def save_history(historyPath
=historyPath
):
42 readline
.write_history_file(historyPath
)
44 readline
.set_completer(myCompleter
)
45 readline
.parse_and_bind("tab: complete")
47 if os
.path
.exists(historyPath
):
48 readline
.read_history_file(historyPath
)
50 atexit
.register(save_history
)
52 del rlcompleter
, readline
, atexit