[sage-devel] Re: Documentation of prcedures with decorator

2011-03-01 Thread Johan S. R. Nielsen
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 th

Re: [sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Robert Bradshaw
On Mon, Feb 28, 2011 at 11:39 PM, Simon King wrote: > Hi Robert, > > On 1 Mrz., 00:15, Robert Bradshaw > 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

[sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Simon King
Hi Robert, On 1 Mrz., 00:15, Robert Bradshaw 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

Re: [sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Robert Bradshaw
On Mon, Feb 28, 2011 at 2:35 PM, Simon King wrote: > Hi Robert! > > On 28 Feb., 21:00, Robert Bradshaw > wrote: >> ... >> Sorry, I forgot to mention that it must be declared as "cdef public >> object __doc__". Otherwise it doesn't create a Python-visible wrapper, >> so you're still (from Python)

[sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Simon King
Hi Robert! On 28 Feb., 21:00, Robert Bradshaw wrote: > ... > Sorry, I forgot to mention that it must be declared as "cdef public > object __doc__". Otherwise it doesn't create a Python-visible wrapper, > so you're still (from Python) accessing the class-level __doc__. So, is there a difference b

Re: [sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Robert Bradshaw
On Mon, Feb 28, 2011 at 11:38 AM, Simon King wrote: > Hi Robert, > > On 28 Feb., 19:56, Robert Bradshaw > wrote: >> If you add a "cdef object __doc__" member to that class, you should be >> able to assign to it. > > I am afraid this is not true. > > One is not able to assign it. __doc__ is read o

[sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Simon King
Hi Robert, On 28 Feb., 19:56, Robert Bradshaw wrote: > If you add a "cdef object __doc__" member to that class, you should be > able to assign to it. I am afraid this is not true. One is not able to assign it. __doc__ is read only, even if you define it cpdef or : sage: cython('''cdef class C:

Re: [sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Robert Bradshaw
On Mon, Feb 28, 2011 at 3:32 AM, Simon King wrote: > On 28 Feb., 12:18, Simon King wrote: >> ... >> I recall that it is impossible >> to modifiy __doc__ in Cython - could this be a related problem? > > That could very well be: cached_method is defined in sage/misc/ > cachefunc.py, whereas coerce_

[sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Simon King
On 28 Feb., 12:18, Simon King wrote: > ... > I recall that it is impossible > to modifiy __doc__ in Cython - could this be a related problem? That could very well be: cached_method is defined in sage/misc/ cachefunc.py, whereas coerce_binop is an alias for a cdef-class NamedBinopMethod from sage/

[sage-devel] Re: Documentation of prcedures with decorator

2011-02-28 Thread Simon King
Hi Marco, On 28 Feb., 11:00, mmarco wrote: > I think that it is because of the @coerce_binop decorator before the > definition of the procedure. So i wonder if it is a general problem > (that is, when you build the html documentation of a procedure which > is defined after a decorator, you get th