It's not so clear to me. Below is some additional information that
people may wish to consider.
A. A related question is whether to explicitly mention "self" at all
in docstrings. It seems like Simon King was just arguing above
*against* doing this. But...
(1) Standard practice in Python, if there is any? -- I did a
very quick google search and couldn't find any real guidance here.
(2) What is already done in the Sage library? If there are
thousands of docstrings in Sage already that explicitly mention
"self", then there's already a very strong precedent to do so and we
shouldn't discourage it, since that leads to inconsistency. In
fact, there are a over 10K explicit references to self in the
reference manual (pulled from docstrings):
sage-6.5.rc1/src/doc/output/html/en/reference$ rgrep self *|wc -l
11748
(3) Python principles. In this case "explicit is better than
implicit" may be relevant. If the docstring says self, it may be ugly
but it is 100% unambiguous. If the docstring says "this polynomial"
it is ambiguous -- does it mean self or another parameter that was
just discussed.
Conclusion: In Sage, there is already strong precedent for including
the word "self" in docstrings.
B. The main question -- what about explicitly documenting self in the
INPUTS block?
DATA: If my grep'ing is right, it's already been done 389 times,
pretty uniformly all over the library:
/scratch/wstein/sage-6.5.rc1/src/sage$ grep -r "\- \`\`self\`\`" *|wc -l
389
So again, there is a nontrivial amount of precedent for explicitly
documenting self in docstrings, at least in some cases.
Anyway, this is just data,
William
--
William Stein (
http://wstein.org)
CEO, SageMath, Inc. (
https://sagemath.com)
Professor of Mathematics, University of Washington