Python Essential: Tab Completion

Sep 26, 2007 22:09


One thing I always find myself configuring on a new or unfamiliar workstation is tab completion for the Python interactive shell. This is actually quite simple; however, I can never seem to remember the syntax from memory. The Python documentation contains a simple howto for configuring this (http://docs.python.org/lib/module-rlcompleter.html) but their impletmentation has a try/except block that I don’t use since I generally know whether or not I have modules available.

.bashrc
export PYTHONSTARTUP=~/.pythonrc

.pythonrc
import rlcompleter
import readline
readline.parse_and_bind(”tab: complete”)
[Posted from Penguin Meet Python]

python

Previous post Next post
Up