#11115: Rewrite cached_method in Cython
-------------------------------------+-------------------------------------
       Reporter:  SimonKing          |        Owner:  jason
           Type:  enhancement        |       Status:  closed
       Priority:  major              |    Milestone:  sage-5.0
      Component:  misc               |   Resolution:  fixed
       Keywords:  category cython    |    Merged in:  sage-5.0.beta0
  cache                              |    Reviewers:  Nicolas M. ThiƩry,
        Authors:  Simon King         |  Andrey Novoseltsev, Volker Braun
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
   Dependencies:  #9138, #11900      |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by jdemeyer):

 Replying to [comment:180 SimonKing]:
 > > It seems that the implementation assumes that `cache` is a `dict`
 anyway (I see lots of `<dict>self.cache` in the code).
 >
 > But certainly not in weak_cached_function.

 I think that's a bad design with all the `<dict>` casts. I would have
 prefered something more like:
 {{{
 class BaseCachedFunction(object):
     pass

 class CachedFunction(BaseCachedFunction):
     cdef dict cache

 class WeakCachedFunction(BaseCachedFunction):
     cdef WeakValueDictionary cache
 }}}

 This is like the classes for dense/sparse vectors.

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

Reply via email to