-
-
Notifications
You must be signed in to change notification settings - Fork 654
Description
Currently, the method _sage_doc_
is used to implement custom documentation for instances of a class. Such a use case makes sense, but it should be implemented as the __doc__
attribute instead of the Sage-specific _sage_doc_
.
I tried various ways of implementing this and I found several Cython bugs along the way. The current solution is not the cleanest, but it works in all cases (Cython and Python, extension types and normal classes).
In the cases where _sage_doc_
was implemented for a base class, this patch requires adding @instancedoc
to every subclass. This is because Python never inherits the __doc__
attribute. There is a way around this using a metaclass, but I avoided that because metaclasses have their own problems (see #21681).
Component: documentation
Keywords: days85
Author: Jeroen Demeyer
Branch/Commit: 5fe7cb0
Reviewer: Erik Bray
Issue created by migration from https://trac.sagemath.org/ticket/22611