📅 2016-Aug-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ pdb, tab completion ⬩ 📚 Archive
A common technique to debug in Python is to add this line at a place which you want to observe:
import pdb; pdb.set_trace();
When you run the Python code and the interpreter hits this line, it drops you into a Python debugger prompt. You can inspect local variables and step through code from here.
An irritating problem here is that this PDB prompt does not offer tab completion. So, you have to type out entire variable, class and method names by yourself without any aid. Thankfully, here is a method to add tab completion feature to this PDB prompt.
.pdbrc in your home directory and add these lines to it:
# Enable tab completion import rlcompleter import pdb pdb.Pdb.complete = rlcompleter.Completer(locals()).complete
Tried with: Python 3.5.1 and Ubuntu 16.04