#17847: Cython: embed signatures in docstrings of Sage library code
-------------------------------------+-------------------------------------
       Reporter:  jdemeyer           |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.6
      Component:  cython             |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jeroen Demeyer,    |    Reviewers:  Simon King, Jeroen
  Simon King                         |  Demeyer
Report Upstream:  Fixed upstream,    |  Work issues:
  but not in a stable release.       |       Commit:
         Branch:                     |  02ee3cc5478de184783d64c609da0d9a083db9c2
  u/jdemeyer/ticket/17847            |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------
Changes (by jdemeyer):

 * status:  needs_review => needs_work


Comment:

 Hmm, this patch doesn't behave so nicely for some of Python's docs:
 {{{
 sage: print type.__doc__
 type(object) -> the object's type
 type(name, bases, dict) -> a new type

 sage: print sage_getdoc_original(type)
 type(name, bases, dict) -> a new type
 }}}

 This causes
 {{{
 sage -t --long src/sage/repl/ipython_tests.py
 **********************************************************************
 File "src/sage/repl/ipython_tests.py", line 10, in sage.repl.ipython_tests
 Failed example:
     shell.run_cell(u'%pinfo dummy')
 Expected:
     Type:            function
     String form:     <function dummy at 0x...>
     File:            /.../sage/repl/ipython_tests.py
     Definition:      dummy(argument, optional=None)
     Docstring:
        Dummy Docstring Title
     <BLANKLINE>
        Dummy docstring explanation.
     <BLANKLINE>
        INPUT:
     <BLANKLINE>
        * "argument" -- anything. Dummy argument.
     <BLANKLINE>
        * "optional" -- anything (optional). Dummy optional.
     <BLANKLINE>
        EXAMPLES:
     ...
     Class docstring:
     function(code, globals[, name[, argdefs[, closure]]])
     <BLANKLINE>
     Create a function object from a code object and a dictionary. The
     optional name string overrides the name from the code object. The
     optional argdefs tuple specifies the default argument values. The
     optional closure tuple supplies the bindings for free variables.
     Init docstring:  x.__init__(...) initializes x; see help(type(x)) for
 signature
 Got:
     Type:            function
     String form:     <function dummy at 0x7f8a0ffe76e0>
     File:            /usr/local/src/sage-git/local/lib/python2.7/site-
 packages/sage/repl/ipython_tests.py
     Definition:      dummy(argument, optional=None)
     Docstring:
        Dummy Docstring Title
     <BLANKLINE>
        Dummy docstring explanation.
     <BLANKLINE>
        INPUT:
     <BLANKLINE>
        * "argument" -- anything. Dummy argument.
     <BLANKLINE>
        * "optional" -- anything (optional). Dummy optional.
     <BLANKLINE>
        EXAMPLES:
     <BLANKLINE>
           sage: from sage.repl.ipython_tests import dummy sage: dummy(1)
           'Source code would be here'
     <BLANKLINE>
     Class docstring:
     Create a function object from a code object and a dictionary. The
     optional name string overrides the name from the code object. The
     optional argdefs tuple specifies the default argument values. The
     optional closure tuple supplies the bindings for free variables.
     Init docstring:  x.__init__(...) initializes x; see help(type(x)) for
 signature
 **********************************************************************
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/17847#comment:105>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to