#9976: Decorated functions/methods have generic signature in documentation
-----------------------------+----------------------------------------------
   Reporter:  jsrn           |       Owner:  mvngu                
       Type:  enhancement    |      Status:  needs_review         
   Priority:  major          |   Milestone:  sage-4.7             
  Component:  documentation  |    Keywords:  sphinx, documentation
     Author:  jsrn           |    Upstream:  N/A                  
   Reviewer:                 |      Merged:                       
Work_issues:                 |  
-----------------------------+----------------------------------------------

Comment(by SimonKing):

 What I would like to have is:
 {{{
 sage: class MyClass:
 ....:     "Class documentation"
 ....:     def _sage_doc_(self):
 ....:         return "Instance documentation"
 ....:
 sage: sage.misc.sageinspect.sage_getdoc(MyClass())
 'Instance documention\n'
 sage: sage.misc.sageinspect.sage_getdoc(MyClass)
 'Class documentation\n'
 }}}

 Then, using `sage_getdoc` in `sage_autodoc.py` would mean that "usual"
 methods of a class would be documented according to their doc string. But
 if it is a decorated method (at least, the following holds true for
 `@cached_method`) then the attribute of the class is in fact a class
 instance:
 {{{
 sage: class MyClass:
 ....:     @cached_method
 ....:     def f(x):
 ....:         return -x
 ....:     def g(x):
 ....:         return -x
 ....:
 sage: MyClass.g.__class__
 <type 'instancemethod'>
 sage: MyClass.f.__class__
 <type 'sage.misc.cachefunc.CachedMethodCaller'>
 }}}

 So, if the decorator has `_sage_doc_` and `_sage_argspec_` then it can be
 used when building the reference.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9976#comment:13>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to