#9976: Decorated functions/methods have generic signature in documentation
--------------------------------+-------------------------------------------
Reporter: jsrn | Owner: jsrn
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.7
Component: documentation | Keywords: sphinx, documentation, cython
inspection
Author: jsrn, Simon King | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------------+-------------------------------------------
Comment(by jsrn):
> VoilĂ .
>
> {{{
> sage: def monkey2(a={(1+2) : 'wee'}):
> ....: return a[3]
> ....:
> sage: sage.misc.sageinspect.sage_getargspec(monkey2)
> ArgSpec(args=['a'], varargs=None, keywords=None, defaults=({3: 'wee'},))
> }}}
>
> > and in general, there's no way to avoid that with your approach, as
you can't match nested parentheses with regular expressions.
>
> By the way, it wasn't my trick. I copied it from the corresponding lines
of _sage_getargspec_cython.
I should have been more clear: the above example works with
sage_getargspec as it never reaches the statement in question. What I
meant was, that some object would reach the definition, then having that
_sage_src_ (or something like it) would cause the regular-expression to
fail. But now I'm pretty confused: which kind of objects did you envision
are classinstances, are callable and have _sage_src_ attribute set?
decorators which have not yet been applied to a function?
>
> > Ok, moving back to realism, is this then really what we want? I mean,
if a decorator is so insightful so as to save the wrapped function's src
in its own _sage_src_, but does not save its argspec in _sage_argspec_,
aren't we asking for errors?
>
> In the near future (#11115) the cached method decorators will have
_sage_argspec_.
>
> > Of course, we could also retain this fix until such time as the
cached_method is fixed, and ticket #11115 could have the removal of this
code in its ticket. Was this what you had in mind all along?
>
> Somehow.
Good :-)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9976#comment:94>
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.