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
qweweretrt515
V2EX  ›  Python

能给 python 函数的每个参数增加 docstring 吗?

  •  
  •   qweweretrt515 · 2016-11-08 13:28:51 +08:00 · 1674 次点击
    这是一个创建于 2732 天前的主题,其中的信息可能已经有所发展或是发生改变。

    好让我们 用 ide 写代码的时候,指着调用函数的地方,就可以显示出 每个参数的具体含义,而不是根据参数名来猜测

    3 条回复    2016-11-08 22:56:31 +08:00
    bazingaterry
        1
    bazingaterry  
       2016-11-08 13:34:10 +08:00 via iPhone   ❤️ 1
    PyCharm 有这功能来着……
    qweweretrt515
        2
    qweweretrt515  
    OP
       2016-11-08 15:12:30 +08:00
    @bazingaterry 我一般用的 vs code pycharm 偶尔用
    ivechan
        3
    ivechan  
       2016-11-08 22:56:31 +08:00   ❤️ 1
    1. 在 function 的 docstring 里写, 参考 PEP-257 -> https://www.python.org/dev/peps/pep-0257/
    2. Type Hint, 参考 PEP-484 -> https://www.python.org/dev/peps/pep-0484/
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2166 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 05:27 · PVG 13:27 · LAX 22:27 · JFK 01:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.