One of Python's great features is that it can be used interactively. I just discovered that it also supports command completion via the rlcompleter module. If you are on Mac OS X, you will first need to install the readline module (run this command: python `python -c "import pimp; print pimp.__file__"` -i readline
). To enable tab completion execute the following code:
import rlcompleter import readline readline.parse_and_bind("tab: complete")
You can set up Python to do this every time you start the interactive interpreter.
PYTHONSTARTUP
environment variable to ~/.pythonrc.py
. You probably want to set this in your ~/.profile
or the equivalent configuration file to make it permanent.~/.pythonrc.py
and add the three lines abovedel readline
and del rlcompleter
to leave a pristine namespaceIf you really like the interactive console, you may wish to play with Holger Krekel's rlcompleter2 module. It displays much more information, like the type and value of objects and the docstrings for modules and functions.