#12601: @cached_method does not work for special methods
-------------------------------------------------+-------------------------
       Reporter:  saraedum                       |        Owner:  jason
           Type:  enhancement                    |       Status:
       Priority:  minor                          |  needs_review
      Component:  misc                           |    Milestone:  sage-5.13
       Keywords:  cached_method, cache,          |   Resolution:
  operator, special method                       |    Merged in:
        Authors:  Simon King                     |    Reviewers:
Report Upstream:  Completely fixed; Fix          |  Work issues:
  reported upstream                              |       Commit:
         Branch:                                 |     Stopgaps:
   Dependencies:  #15038                         |
-------------------------------------------------+-------------------------

Comment (by nbruin):

 Replying to [comment:12 SimonKing]:

 > Right. However, if we are talking about a cached non-special double
 underscore
 > method for an instance that allows to assign attributes, then the
 distinction
 > between `CachedMethod` and `CachedSpecialMethod` is irrelevant!

 Only if the number of calls is significantly larger than 1.

 > But of course, we could do a look-up in a finite list of special
 methods. I
 > just fear that this would create an even bigger slow-down (''if'' there
 is any
 > slow-down noticeable).

 No that should be fine. Strings like that would be fully interned, so
 looking
 them up in a set or as dictionary keys will actually be significantly
 faster
 than doing string manipulations. (remember that these are attribute names.
 Python is very much invested in making attribute lookup lightning fast)

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

Reply via email to