#16316: cached_function and cached_method for unhashable elements
-----------------------+-------------------------------
Reporter: saraedum | Type: enhancement
Status: new | Priority: minor
Milestone: sage-6.2 | Component: misc
Resolution: | Report Upstream: N/A
-----------------------+-------------------------------
Caching does currently not work for unhashable elements
{{{
sage: @cached_function
....: def f(x):
....: return x
....:
sage: K.<a> = Qq(9)
sage: f(a)
TypeError: unhashable type:
'sage.rings.padics.padic_ZZ_pX_CR_element.pAdicZZpXCRElement'
}}}
In this case `a` should not be hashable since its current operator `==`
could
never be made consistent with a non-trivial hash value (cf. #11895).
However, such elements should be cacheable.
This ticket adds a `_cache_key()` for such elements which can be used to
hash and
compare unhashable elements. That method should then return a tuple (or
anything else that is hashable) which uniquely identifies the element,
e.g. for
p-adics the precision and a lift of the element to the integers.
--
Ticket URL: <http://trac.sagemath.org/ticket/16316>
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.