#16316: cached_function and cached_method for unhashable elements
-------------------------------------+-------------------------------------
       Reporter:  saraedum           |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  minor              |    Milestone:  sage-6.3
      Component:  misc               |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Julian Rueth       |    Reviewers:  Peter Bruin
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/saraedum/ticket/16316            |  22d1d8ebe8c9dbdfeee93c344e2a3c8d16325142
   Dependencies:  #16251             |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by tscrim):

 > _cache_key() is only invoked if the object is unhashable. For most
 hashable objects it raises an error.

 Ah I misinterpreted a part of the code. So since you only call the
 function `_cache_key` (in `cachefunc.pyx`) when `hash` doesn't work, so
 the first try-except block in the function is redundant. I've reworked
 some things around knowing this, which should simply things.

 Also instead of a raising a `NotImplementedError`, I think we should raise
 a `TypeError` to be consistent when elements are unhashable. I tried to
 implement a version using `@lazy_attribute`, but it doesn't currently have
 full support for the cython inheritance.

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