为什么 PDB 似乎不像普通 Python 解释器那样在所有对象上支持 help()?

Why doesn't PDB seem to support help() on all objects like the normal Python interpreter?

似乎 运行 "help(object)" 在 PDB 中并没有真正起作用,而在常规解释器中它似乎大部分时间都工作得很好。它使调试,尤其是在新项目中,有点烦人 - 有什么办法可以解决这个问题吗?

(Pdb) help(int)
*** No help on (int)

当您在 pdb 中键入 help... 时,它会调用 pdb 自己的内置 help 命令,该命令提供有关使用 pdb 的帮助。

对于您正在寻找的 help,您可以使用 ! 前缀绕过 pdb 的内置函数:

(Pdb) !help(int)

Help on class int in module __builtin__:

class int(object)
 |  int(x=0) -> int or long
 |  int(x, base=10) -> int or long
 ...


(Pdb) help

Documented commands (type help <topic>):
========================================
EOF    bt         cont      enable  jump  pp       run      unt   
a      c          continue  exit    l     q        s        until 
alias  cl         d         h       list  quit     step     up    
args   clear      debug     help    n     r        tbreak   w     
b      commands   disable   ignore  next  restart  u        whatis
break  condition  down      j       p     return   unalias  where 

Miscellaneous help topics:
==========================
exec  pdb

Undocumented commands:
======================
retval  rv