On Monday, October 27, 2014 2:33:34 PM UTC-7, Volker Braun wrote:
>
> The you can just as well get rid of @cached_method, that of course also 
> solves the problem.
>

Note quite, thanks to http://trac.sagemath.org/ticket/16316 , which 
basically implements the scheme Robert proposes and uses that automatically 
if a normal "hash" is not available.

In general I expect that cached_methods should preprocess their arguments a 
bit before doing a key lookup anyway (such as do the required coercions on 
arguments). Most of the time, functions with arguments should *not* be 
cached, because their cache quickly becomes a memory leak.

The most important place where caching happens is 
UniqueFactory/UniqueRepresentation. These are mostly parent constructors, 
so tend to be very lenient in their input specifications. So their input 
should probably be uniformized quite agressively before using as a key. The 
current interface doesn't make that particularly easy.
 

> IMHO every immutable element ought to be hashable.
>

 I agree with that. With the understanding that "a==b"  => "hash(a) == 
hash(b)" is only guaranteed to apply when "parent(a) is parent(b)", 
hopefully extending a little beyond.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to