#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/tscrim/ticket/16316              |  7a9a6b2a3e4a68bfd3c9d8d6556a883e1d1161e0
   Dependencies:  #16251             |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by saraedum):

 * branch:  u/saraedum/ticket/16316 => u/tscrim/ticket/16316


Comment:

 Replying to [comment:29 tscrim]:
 > If you're happy with my changes, then it's a positive review.
 It's a very good idea to include the description in the summary of
 `cachefunc.pyx`. But I also think it should be in `SageObject._cache_key`;
 if somebody is wondering what it is good for, that is the first place
 where they will look for it. It is a duplication of docstrings but I hope
 it is acceptable.

 I made a few changes to your commit:
  * I removed some debug statements.
  * Your changes to `_cache_key` change the current behaviour. Say you have
 a tuple of a polynomial over the rationals and a p-adic number. The old
 version would only call `_cache_key` of the p-adic number and leave the
 polynomial. Your version unpacks both which is unnecessary. I restored my
 version of the code.
  * The default implementation of `_cache_key` should raise an error. If
 somebody calls it (misunderstanding what it is good for), then it makes
 sense to warn people that they did something wrong: the code in
 `SageObject._cache_key()` will never be executed in a legitimate context.
 I do not mind raising a `TypeError` instead of a `NotImplementedError`.

 > Thanks for dealing with my nagging.
 No worries. After all you found a very serious bug (`id(parent)`).

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