You can customize Python's built-in debugger (PDB) by creating a ~/.pdbrc file with custom aliases. The post shares a practical set of aliases: `dir` to print non-dunder attributes and methods, `attrs` for non-method data attributes only, `vars` for instance variables, `src` to display source code and location of a class or function, and `loc` to list local variables in the current frame. Each alias formats output more readably than the equivalent built-in calls. Key limitations of .pdbrc are noted: aliases must be written on a single line, and variable assignments in aliases leak into the surrounding scope (requiring explicit `del` cleanup).
Table of contents
The aliases in my ~/.pdbrc fileA demo of these 5 aliases~/.pdbrc isn’t as powerful as PYTHONSTARTUPSort: