#15056: Bind the wrapped function to the instance to which a
`CachedMethodCaller`
is bound
---------------------------+-----------------------------
Reporter: SimonKing | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.12
Component: misc | Keywords:
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies: #12601
Stopgaps: |
---------------------------+-----------------------------
Currently, a cached method will always be a wrapper of a function. It will
bind a `CachedMethodCaller` to an instance. However, this
`CachedMethodCaller` will ''not'' bind the wrapped function to the
instance. But in some cases, we might want to make the function depend on
the instance, see #12978, for example.
Therefore, I suggest to store the ''bound'' version of the wrapped
function when binding a `CachedMethodCaller` to an instance. There might
be a slight benefit timewise, too:
{{{
sage: def f(self, x): pass
sage: m = f.__get__(ZZ, type(ZZ))
sage: %timeit f(ZZ, 3)
1000000 loops, best of 3: 333 ns per loop
sage: %timeit m(3)
1000000 loops, best of 3: 320 ns per loop
}}}
I make #12601 a dependency, since it touches the same file.
--
Ticket URL: <http://trac.sagemath.org/ticket/15056>
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/groups/opt_out.