V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
vtoexsir
V2EX  ›  Python

怎么准确定位每一条 pydoc(主要是类和方法的说明性文本)在源代码字符串中的位置?

  •  
  •   vtoexsir · 2017-06-14 17:28:37 +08:00 · 1426 次点击
    这是一个创建于 2501 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用 epydoc 等库,可以得到相关的 pydoc 说明。
    如果我只想得到 a.py 这个源码文件的 pydoc,改怎么办呢?
    如果 a.py 源码中有个 d()方法,d()方法也有说明文本,那我怎么得到这个 d()方法的说明文本?并得到该说明文本在 a.py 源码中的位置?

    想从 epdoc 库看看它是怎么得到 pydoc 的,但我比较菜,不会调试跟踪。

    如果自己使用正则,我想也是可行的。但感觉不容 pydoc 那样准确吧。
    所以,还是想知道有没有这样的现成的库或者方法,再或者是思路。
    多谢您的回复!

    1 条回复    2017-06-14 17:37:29 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   900 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 353ms · UTC 20:53 · PVG 04:53 · LAX 13:53 · JFK 16:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.