#17814: Make calling a cached method independent of source code inspection
-------------------------------------+-------------------------------------
       Reporter:  SimonKing          |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.6
      Component:  distribution       |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Simon King         |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  
u/SimonKing/make_calling_a_cached_method_independent_of_source_code_inspection| 
 30543e7b283c52cad2fbeb060efe78a74c7b42ba
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by nbruin):

 Replying to [comment:32 jdemeyer]:
 > Personally, I still think that [comment:15] is the best solution (but
 I'm still open to other suggestions).

 This information is cheaply available when cython does its work, We could
 ask the cython devs if they would be willing to equip their function
 objects with attributes that play the role of `__code__.co_argcount`,
 `__code__.co_flags` (to see if `*args` or `**kwds` is present),
 `__code__.varnames`, `func_defaults`.

 Cython writes the code that splits up the `*args` and `**kwargs` that
 python calls at C-API get, and generates errors if it doesn't fit some
 internal pattern. For inspection and dynamical code, the required pattern
 information should really be made available.

 They could either write it into the docstring (as they already do with
 source file information) or they could put some attributes on their cython
 function objects.

 Example:
 {{{
 sage: cython("""def f(a,b=0): pass""")
 sage: f(a=1)
 sage: f(b=1)
 TypeError: f() takes at least 1 positional argument (0 given)
 sage: f(1,c=1)
 TypeError: f() got an unexpected keyword argument 'c'
 }}}
 I think it's quite reasonable if cython would make available what the
 number of positional arguments can be and which keyword arguments are
 accepted.

--
Ticket URL: <http://trac.sagemath.org/ticket/17814#comment:33>
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