Created
January 27, 2009 18:02
-
-
Save travisbhartwell/53448 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is startup file for interactive python. | |
| # Text version here | |
| # | |
| # Generated by GVIM :so $VIMRUNTIME/syntax/2html.vim | |
| # | |
| # It is not automatically loaded by python interpreter. | |
| # To instruct the interpreter to load it insert the following commands | |
| # into your .profile (or whatever file is appropriate for your shell): | |
| # | |
| # PYTHONSTARTUP=$HOME/.init.py | |
| # export PYTHONSTARTUP | |
| from __future__ import nested_scopes | |
| def init(): | |
| # From Guido van Rossum, | |
| # http://www.onlamp.com/pub/a/python/2001/06/14/pythonnews.html | |
| class _Helper: | |
| def __repr__(self): | |
| return "Please type help() for interactive help." | |
| def __call__(self, *args, **kwds): | |
| import pydoc | |
| return pydoc.help(*args, **kwds) | |
| import __builtin__ | |
| __builtin__.help = _Helper() | |
| import sys, os | |
| # From Bruce Edge, http://groups.yahoo.com/group/python-list/message/128961 | |
| try: | |
| import rlcompleter, readline | |
| readline.parse_and_bind("tab: complete") | |
| readline.parse_and_bind("M-tab: menu-complete") | |
| initfile = os.path.join(os.environ["HOME"], ".inputrc") | |
| readline.read_init_file(initfile) | |
| histfile = os.path.join(os.environ["HOME"], ".python-history") | |
| readline.read_history_file(histfile) | |
| def savehist(): | |
| readline.set_history_length(50) | |
| readline.write_history_file(histfile) | |
| import atexit | |
| atexit.register(savehist) | |
| except (ImportError, AttributeError): | |
| pass # no readline or atexit, or readline doesn't have | |
| # {read,write}_history_file - ignore the error | |
| init() | |
| del init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment