【问题标题】:why help() command under ipdb gives an error为什么ipdb下的help()命令会报错
【发布时间】:2016-05-02 13:38:27
【问题描述】:

ipython 我可以发出以下命令,它会给我帮助:

In [1]: help(["foo", "bar", "baz"])

class list(object)
 |  list() -> new empty list
 |  list(iterable) -> new list initialized from iterable's items
 |
 |  Methods defined here:
 |
 |  __add__(...)
 |      x.__add__(y) <==> x+y
 |
 |  __contains__(...)
 |      x.__contains__(y) <==> y in x
...

但是当我在 ipdb 内部做同样的事情时,我得到一个错误:

ipdb> help(["foo", "bar", "baz"])
*** No help on (["foo", "bar", "baz"])

为什么?

【问题讨论】:

    标签: python debugging ipython ipdb


    【解决方案1】:

    help 是 pdb 中的一个特殊命令。您需要显式调用p help(obj) 而不是help(obj)。如果你只在 pdb 中单独调用 help,你可以看到区别。

    【讨论】:

      猜你喜欢
      • 2020-01-20
      • 2011-03-25
      • 2018-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-19
      • 2017-04-24
      • 2017-04-26
      相关资源
      最近更新 更多