-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pythonrc
More file actions
34 lines (30 loc) · 941 Bytes
/
.pythonrc
File metadata and controls
34 lines (30 loc) · 941 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
from __future__ import print_function
import sys, os, rlcompleter
# Readline with history saving.
try:
import readline, atexit
readline.parse_and_bind('tab: complete')
histfile = os.path.join(os.path.expandvars('$HOME'), ".pyhistory")
try:
readline.read_history_file(histfile)
except IOError:
pass # It doesn't exist yet.
def savehist():
try:
readline.write_history_file(histfile)
except:
print('Unable to save Python command history')
atexit.register(savehist)
except ImportError:
pass
# Pretty-print at the command prompt for more readable dicts and lists.
from pprint import pprint
try:
_builtins = __import__('__builtin__')
except ImportError:
_builtins = __import__('builtins')
def mydisplayhook(value, show=pprint, bltin=_builtins):
if value is not None:
bltin._ = value
show(value)
sys.displayhook = mydisplayhook