#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|
a0b829dc10b4ccb00b99e073de8a1c0006aa1e51
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:43 jdemeyer]:
> I think this trick only works with module-level functions, not method
(but I need to recheck).
It does seem to work for `class` in cython, but sadly not for `cdef
class`:
{{{
cython("""
my_global=[]
def mydec(a):
global my_global
my_global.append(a)
return(a)
import cython
class A(object):
@mydec
@cython.binding(True)
def b(x,y=0):
pass
cdef class B(object):
@mydec
@cython.binding(True)
def b(x,y=0):
pass
""")
}}}
{{{
sage: my_global
[<cyfunction A.b at 0x7f1b0e947590>,
<method 'b' of '_home_nbruin__sage_temp_art_17765_tmp_DC65IM_spyx_0.B'
objects>]
}}}
The first object does have the `func_*` attributes, but the second
doesn't. Perhaps that is something that the cython devs can do something
about.
--
Ticket URL: <http://trac.sagemath.org/ticket/17814#comment:47>
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.