Enable Auto-complete in a PDB session

EDIT: 2012-06-19 There are so many other much better options now that renders recipe obsolete. See pdb++ or ipdb

Pretty simple actually…Just put the following code in ~/.pdbrc and then you can use the Tab key during a PDB session to see the available attributes of the current context.

import rlcompleter
pdb.Pdb.complete=rlcompleter.Completer(locals()).complete