-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pythonrc
47 lines (32 loc) · 988 Bytes
/
.pythonrc
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
42
43
44
45
46
47
#!/bin/python
import atexit
import os
try:
import readline
except ImportError:
print(".pythonrc :: Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
history_file = os.path.join(os.path.expanduser("~"), ".pyhistory")
def save_history(history=history_file):
import readline
readline.write_history_file(history)
print(".pythonrc :: history saved to " + history)
def load_history(history=history_file):
try:
readline.read_history_file(history)
except IOError:
pass
load_history()
atexit.register(save_history)
del readline, rlcompleter, atexit, history_file
# In addition to os, import some useful things
# noinspection PyUnresolvedReferences
import re
# noinspection PyUnresolvedReferences
from collections import *
# noinspection PyUnresolvedReferences
from itertools import *
# Add python-tools module
from tools import *