This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年07月24日 23:05 by tkiss80, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg141061 - (view) | Author: (tkiss80) | Date: 2011年07月24日 23:05 | |
If an entity does not have a docstring, pydoc.getdoc() reads the comment associated with that entity and uses that as the source of documentation. However, inspect.getcomments() returns the raw comment with the comment signs ('#') in it, thus the resulting documentation looks ugly and confusing. Is there a way to solve this problem?
I know that this is not an easy task, because by implementing a specific '#' removing solution, the format of the doc comments would be restricted to conform to that algorithm with little formatting freedom. But maybe someone can come up with a good idea, such as counting '#'-s in the first line and strip all the lines accordingly.
|
|||
| msg141062 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2011年07月24日 23:22 | |
The best solution is to modify the offending code to use real docstrings.
Failing that, a simple explicit "'\n'.join(line.lstrip('#' for line in comment.split('\n'))" (i.e. not as part of pydoc) will handle most cases.
Anything more sophisticated would need to be tailored to the comment format of the code that is missing docstrings.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:20 | admin | set | github: 56839 |
| 2011年07月24日 23:22:19 | ncoghlan | set | status: open -> closed nosy: + ncoghlan messages: + msg141062 resolution: rejected stage: resolved |
| 2011年07月24日 23:05:00 | tkiss80 | create | |