Ipdb and method documentation

一个人想着一个人 提交于 2019-12-08 16:27:18

问题


I have to analyze methods a foreign API, and how I usually do it it to write a test script, or find an example code, do a

ipdb.set_trace()

Where I want to experiment, and than take a look at currently available variables, objects and their methods. However, when I want to check the documentation the way Ipython offers

object.method?

I get

*** SyntaxError: invalid syntax (<stdin>, line 1)

If I try

help(object.method)

It gives

*** No help on (object.method)

Does that mean that there is no documentation for the selected method, or am I using the wrong way of calling it?


回答1:


The help() function is actually a wrapper around pydoc.help() which means that you can do something like:

ipdb> import math
ipdb> import pydoc
ipdb> pydoc.help(math.log)



回答2:


Actually !help(object.method) works, you just need to signify with ! that it's a python command, not ipdb help command. Though convenient question mark doesn't work that way unfortunately.



来源:https://stackoverflow.com/questions/12455374/ipdb-and-method-documentation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!