#12603: copying cached_methods does not work properly
-----------------------------+----------------------------------------------
   Reporter:  saraedum       |          Owner:  jason               
       Type:  PLEASE CHANGE  |         Status:  new                 
   Priority:  minor          |      Milestone:  sage-5.0            
  Component:  misc           |       Keywords:  cached_method, cache
Work_issues:                 |       Upstream:  N/A                 
   Reviewer:                 |         Author:                      
     Merged:                 |   Dependencies:                      
-----------------------------+----------------------------------------------
 A few funny things can happen when copying cached methods:

 {{{
 sage: class A:
 ...       @cached_method
 ...       def f(self):
 ...           return 1
 ...
 sage: class B:
 ...       g=A.f
 ...       def f(self):
 ...           return 2
 ...
 ...
 sage: b=B()
 sage: b.f()
 2
 sage: b.g()
 1
 sage: b.f()
 1
 }}}

 The problem is that a call to b.g leads to a new MethodCaller in b.f;
 something similar happens here:
 {{{
 sage: class C:
 ...       g=A.f
 ...
 sage: c=C()
 sage: c.g is c.g
 False
 sage: c.g is c.f
 True
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12603>
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.

Reply via email to