Hi Michael, perhaps the code in src/sage/docs/instancedoc.pyx is helpful for you?
I see several problems: 1. It is possible to override the __doc__ of an anbound method, but this would override the __doc__ also in the parent class: sage: class A: ....: def my_method(self): ....: "Some doc" ....: pass ....: sage: class B(A): pass sage: B.my_method.__doc__ = "Some other doc" sage: A.my_method.__doc__ 'Some other doc' 2. It is impossible (without Cython, at least) to override the __doc__ of a bound method: sage: a = A() sage: a.my_method.__doc__ = "Some more doc" ... AttributeError: attribute '__doc__' of 'method' objects is not writable 3. I thought a potential solution would be to create a subclass FlexibleDocMethodType of types.MethodType that uses the instancedoc decorator, say by accessing some attribute of the_method.__self__ that holds the new doc. "Usual" methods would then (via some decorator) be replaced by instances of FlexibleDocMethodType. But unfortunately it seems that types.MethodTypes cannot be subclassed: sage: from types import MethodType sage: class FlexibleDocMethodType(MethodType): ....: pass ....: ... TypeError: type 'method' is not an acceptable base type Best regards, Simon On 2020-03-18, Michael Jung <micj...@uni-potsdam.de> wrote: > Dear developers, > to reduce redundancies in the SageManifolds code, we plan to inherit most > methods and classes from a (mathematically) more general setup. > Still, the current documentation is mandatory. Is it possible to establish > new documentations for inherited methods? > > An example: > > class Mother(SageObject): > def my_method(self): > r""" > Some Documentation. > """" > return 'Bam!' > > class Daughter(Mother): > pass > > For the class "Daughter", the method "my_method" shall have a separate > self-containing documentation. > > Best regards > Michael > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/r4vsbf%243tql%241%40ciao.gmane.io.