"The aliases in my ~/.pdbrc file allow me to use dir, attrs, and vars to inspect Python objects, src to see the source code of a particular function/class, and loc to see the local variables."
"Using the dir alias, we see every attribute that's accessible on an object printed in a pretty friendly format, while attrs shows just the non-method attributes."
"The src alias can be used to see the source code for a given method, and the loc alias will show us all the local variables defined in the current scope."
"~/.pdbrc isn't as powerful as PYTHONSTARTUP, which is launched every time a new Python REPL starts, allowing for more extensive customization."
Custom aliases can be created in the .pdbrc file to enhance the Python debugger (PDB). Useful aliases include dir, attrs, vars, src, and loc for inspecting objects, viewing source code, and checking local variables. These aliases provide a more user-friendly output compared to standard Python commands. While the .pdbrc file offers limited customization compared to a PYTHONSTARTUP file, it still significantly improves the debugging experience by allowing quick access to important information during PDB sessions.
Read at Treyhunner
Unable to calculate read time
Collection
[
|
...
]