I don't know what influence there is from Cython, but for general
python-functions, decorators need to decorate their return functions
with @sage_wraps (see e.g. sage.plots.contour_plot.contour_plot) to
get the correct doc-strings. Setting these could be done manually in
the decorator, but it is the intention that sage_wraps should
coherently take care of all this and related stuff, so this should
always be used instead of manually setting these. If decorated Cython
functions are special, perhaps we should make a Cython-version of
sage_wraps to fix this in the same, coherent manner.

Even when using sage_wraps, Sphinx still uses the argument strings of
the decorator when compiling the documentation. I posted a patch (Trac
#9976) for this several months ago, which patches Sphinx and enhances
the capabilities of sage_wraps to fix this, but there hasn't been a
reviewer.

Regards,
Johan

On Mar 1, 8:48 am, Robert Bradshaw <rober...@math.washington.edu>
wrote:
> On Mon, Feb 28, 2011 at 11:39 PM, Simon King <simon.k...@uni-jena.de> wrote:
> > Hi Robert,
>
> > On 1 Mrz., 00:15, Robert Bradshaw <rober...@math.washington.edu>
> > wrote:
> >> ...
> >> > Namely, cached_method tries to obtain certain attributes common to
> >> > python functions from its argument. func_defaults is just one among
> >> > others.
>
> >> We don't have as much freedom here, as C-defined and python-defined
> >> functions are quite different (standard library) objects. In this
> >> case, cached_method should recognize
> >> method_descriptors/builtin_function_or_method types and handle them
> >> differently (if possible).
>
> > Where is the source code for method_descriptor or
> > builtin_function_or_method? What is needed to be cimported from where,
> > in order to access the attributes corresponding to func_defaults and
> > friends?
>
> The source code is in the Python library itself, 
> e.g.http://svn.python.org/projects/python/trunk/Objects/methodobject.c
> There's no direct analogue to many of these fields...
>
> - Robert

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to