-
Notifications
You must be signed in to change notification settings - Fork 16
/
.pythonrc
28 lines (25 loc) · 866 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
# ~/.pythonrc
# enable syntax completion
from __future__ import print_function
import sys
try:
from ptpython.repl import embed
except ImportError:
try:
from jedi.utils import setup_readline
setup_readline()
except ImportError:
# Fallback to the stdlib readline completer if it is installed.
# Taken from http://docs.python.org/2/library/rlcompleter.html
print("Jedi is not installed, falling back to readline")
try:
import readline
import rlcompleter # NOQA: 40
readline.parse_and_bind("tab: complete")
except ImportError:
print(
"Readline is not installed either. No tab completion is enabled.",
)
else:
print("ptpython is not available: falling back to standard prompt")
sys.exit(embed(globals(), locals()))