python interpreter (history + autocomplete)


 # startup script for python to enable saving of interpreter history and
 # enabling name completion
 # import needed modules
 import atexit
 import os
 import readline
 import rlcompleter
 # where is history saved
 historyPath = os.path.expanduser("~/.pyhistory")
  # handler for saving history
  def save_history(historyPath=historyPath):
     import readline
 # read history, if it exists
 if os.path.exists(historyPath):
 # register saving handler
 # enable completion
 readline.parse_and_bind('tab: complete')
 # cleanup
 del os, atexit, readline, rlcompleter, save_history, historyPath


export PYTHONSTARTUP=~/.pyrc
python.txt · Last modified: 2009/05/25 00:35 (external edit)
CC Attribution-Noncommercial-Share Alike 4.0 International
Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0 ipv6 ready