I make frequent use of the python's built-in debugger, which I think is brilliant in its simplicity. However an important feature seems to be missing: bash-like tab completion similar to that provided by the rlcompleter module.

By default, Pdb and other instances of Cmd complete names for commands only. However in the context of pdb, I think it is more useful to complete identifiers and keywords in its current scope than to complete names of commands (most of which have single letter abbreviations). I believe this makes pdb a far more usable introspection tool.


I've attached a patch to pdb.py (on Python 2.4.4c1). The only real difference to rlcompleter's default complete method is that because pdb changes scope as you step through a program, rlcompleter's namespace is updated to reflect the current local and global namespace.

This is my first attempt at a python patch. Any suggestions or improvements are welcome.

Stephen Emslie