Description
The class
sphinx directive is used (see it's docs), but wrongly:
cpython/Doc/library/stdtypes.rst
Lines 4251 to 4258 in 6313cdd
It looks (despite this seems to be not documented in sphinx-doc), that the second signature takes precedence and methods below could be referenced (either internally in CPython or with the intersphinx for external projects) only like
frozenset.foo
, which is especially silly in cases like frozenset.add
.
We could mitigate this by reordering set and frozenset in the class
directive (references to set's methods are more common), but this is not a real solution.
One option to solve the problem is using two class
directives (like for list/tuple). BTW, while technically the set is not a subtype of the frozenset, in fact it just has some overloaded ops and a bunch of new methods...
Another option is a new sphinx directive like currentmodule
: "Directive currentclass
(similar to currentmodule
) would help us." Originally posted by @serhiy-storchaka in #114280 (comment)
Finally, it could be viewed as a sphinx-only issue: the class directive must support references for every declared signature (i.e. both set.add
and frozenset.add
).