开发者

Are docstrings for internal functions (python) necessary? [closed]

开发者 https://www.devze.com 2023-04-11 05:19 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing th
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 5 years ago.

The community reviewed whether to reopen this question 10 months ago and left it closed:

Original close reason(s) were not resolved

Improve this question

In python we designate internal function/ private methonds with an underscore at the beginning. Should these functions be documented with docstrings(is it required?)? (the formal documentation i mean, not the one helping the code-reader to understand the code) What is common pract开发者_如何转开发ice for this?


Lo, I quote from PEP 8, the wise words of which should be considered law. Upon this very topic, PEP 8 saith:

  • Write docstrings for all public modules, functions, classes, and methods. Docstrings are not necessary for non-public methods, but you should have a comment that describes what the method does. This comment should appear after the "def" line.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号