3 ms·
The difference is in tooling. Docstrings are collected and displayed in many contexts. The intended purpose is writing “documentation” in the same place as code
by powersnail 6y ago
The difference is in tooling. Docstrings are collected and displayed in many contexts. The intended purpose is writing “documentation” in the same place as code. Comments are only seen if you open the source file.
- BurningFrog 6y agoOK, I can see how that's useful for a certain workflow. The way we work, it's just a different comment syntax. I do like have a dedicated place for it.
- xapata 6y agoPython's builtins, the standard library, and many popular community libraries and tools use docstrings to generate tooling and documentation websites. Describing it as "useful for a certain workflow" is so understated it borders on false. The reverse is more true: docstrings are not useful for a certain workflow, but most Python programmers will find them quite helpful. All Python programmers already benefit from the docstrings written in the libraries they use, which generate tooltips and documentation websites.