#12601: @cached_method does not work for special methods
------------------------+---------------------------------------------------
   Reporter:  saraedum  |          Owner:  jason                                
         
       Type:  defect    |         Status:  new                                  
         
   Priority:  minor     |      Milestone:  sage-5.0                             
         
  Component:  misc      |       Keywords:  cached_method, cache, operator, 
special method
Work_issues:            |       Upstream:  Reported upstream. Little or no 
feedback.     
   Reviewer:            |         Author:                                       
         
     Merged:            |   Dependencies:                                       
         
------------------------+---------------------------------------------------
 Caching does not work for the {{{~}}} operator.

 {{{
 sage: class A(object):
 ...    @cached_method
 ...    def __invert__(self):
 ...        return 1
 sage: a = A()
 sage: ~a is ~a
 False
 }}}

 Also the value of {{{a.__invert__}}} changes when calling {{{~a}}}.

 This happens because special methods are called through the type and not
 the actual instance for new-style classes:
 
http://docs.python.org/release/2.7.2/reference/datamodel.html?highlight=data%20model
 #special-method-lookup-for-new-style-classes

 As of 5.0.beta4 no operators in sage use {{{@cached_method}}}.

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