forked from ryanb/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_startup.py
More file actions
41 lines (36 loc) · 834 Bytes
/
python_startup.py
File metadata and controls
41 lines (36 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# python startup file
import readline
import rlcompleter
import atexit
import os
from os import path
import sys
from datetime import datetime
from pprint import pprint
from timeit import timeit
from collections import namedtuple
from collections import defaultdict
assert datetime
assert pprint
assert sys
assert timeit
try:
from see import see
except:
print('see module not installed')
else:
assert see
# tab completion
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")
# history file
histfile = path.join(os.environ['HOME'], '.pythonhistory')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
del histfile, readline, rlcompleter
print("^_^ type away")