[Python-ideas] tab completion in pdb

stephen emslie stephenemslie at gmail.com
Thu Feb 8 11:44:20 CET 2007

There has been some discussion about this off-list. Most of the
discussion has centered around what appropriate tab completion should
be in different cases (what should be offered in the completion
namespace and when).

pydb has been dealt with a number of these issues already (thanks
Rocky Bernstein).

I would like to continue the discussion here. Here's a quick summary:
 - when a line is blank, pdb commands and valid identifiers and
keywords should be included in the namespace.
 - if a line does not start with a pdb command, then it is a python
expression and can be completed by rlcompleter, with all valid
identifiers and keywords available in the namespace.
 - if a line does start with a pdb command then we should decide on
the best way to complete each pdb command.

for example:
" "[complete] -> all possible commands, identifiers and keywords
"b"[complete] -> "basestring  bool        break       buffer"
"basestring."[complete] -> "basestring.__base__
basestring.__delattr__ ... etc."
"break "[complete] -> whatever the pdb completer will offer

currently, the submitted patch only attempts to complete python
expressions with rlcompleter. I think it would be useful (and more
honest, as Rocky puts it) to offer completion for pdb commands as
well. Apart from general comments, what would be great are suggestions
on what sort of completion should follow the various pdb commands.

Stephen Emslie

On 1/22/07, stephen emslie <stephenemslie at gmail.com> wrote:
> Thanks for taking a look. I've created a patch relative to pdb.py in svn and submitted it to sourceforge here:
>  http://sourceforge.net/tracker/index.php?func=detail&aid=1641544&group_id=5470&atid=305470
> On 1/19/07, Aahz < aahz at pythoncraft.com> wrote:
> > On Fri, Jan 19, 2007, stephen emslie wrote:
> > >
> > > 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.
> >
> > Please go ahead and upload this patch to SourceForge to make sure it
> > doesn't get lost.  Thanks!
> > --
> > Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/
> >
> > Help a hearing-impaired person:  http://rule6.info/hearing.html
> >

More information about the Python-ideas mailing list