Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call help() from within pdb

Tags:

python

pdb

I'd like to have the interactivity of pdb, but also need to use python's help function to introspect objects/methods that I am not familiar with using.

How can I use python's help() from pdb?

everything I try gives me:

(Pdb) help(help)
*** No help on (help)
(Pdb) help(list())
*** No help on (list())
like image 266
ThorSummoner Avatar asked Dec 24 '22 21:12

ThorSummoner


2 Answers

If you want to evaluate an expression using PDB, you use p.

(Pdb) p help(list)

The debugger command docs are here: PDB Debugger Commands

like image 151
valdarin Avatar answered Dec 27 '22 12:12

valdarin


I had problems to get help from pdb too but apparently, inserting ! before the command does the job like:

(Pdb++) !help(help)
like image 30
MarcoMag Avatar answered Dec 27 '22 11:12

MarcoMag