Mercurial > public > dotfiles
annotate python/.pythonstartup @ 24:f5af5e32dcdc
Don't control *.pyc files in the repo.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 09 Jan 2015 11:35:06 -0600 |
parents | 357906c82c1f |
children |
rev | line source |
---|---|
bgneal@14 | 1 # python startup file |
bgneal@14 | 2 try: |
bgneal@14 | 3 import readline |
bgneal@14 | 4 except ImportError: |
bgneal@14 | 5 pass |
bgneal@14 | 6 else: |
bgneal@14 | 7 import atexit |
bgneal@14 | 8 import os |
bgneal@14 | 9 import rlcompleter |
bgneal@14 | 10 |
bgneal@14 | 11 # tab completion |
bgneal@14 | 12 readline.parse_and_bind('tab: complete') |
bgneal@14 | 13 |
bgneal@14 | 14 # history file |
bgneal@14 | 15 histfile = os.path.join(os.environ['HOME'], '.pythonhistory') |
bgneal@14 | 16 try: |
bgneal@14 | 17 readline.read_history_file(histfile) |
bgneal@14 | 18 except IOError: |
bgneal@14 | 19 pass |
bgneal@14 | 20 readline.set_history_length(1024) |
bgneal@14 | 21 |
bgneal@14 | 22 atexit.register(readline.write_history_file, histfile) |
bgneal@14 | 23 del os, histfile, readline, rlcompleter |