There is the do_pickle argument, e.g. from TFM:

sage: class C:
....:     @cached_method(do_pickle=True)
....:     def __hash__(self):
....:         return id(self)


Note that it can cause the following problem: Not every circularly 
dependent collection of cython objects can be pickled. Cached values can 
make the difference between what can an cannot be pickled. So whether or 
not pickling works can't reliably be tested in that case. 


On Thursday, June 27, 2019 at 5:07:04 AM UTC+2, Kwankyu Lee wrote:
>
> Hi,
>
> Suppose I have an object X. I computed X.genus(), which took a long time. 
> The method genus() is a cached method. So it gives the result quickly next 
> time. Then I saved the object X. After loading X in a new session, I want 
> X.genus() to give the cached result rather than computing it again.
>
> Is it possible to implement genus() to behave in such a way? Is there some 
> option to @cached_method decorator for that purpose?
>
> I am reading the code for cached methods, but you answer will help me. 
> Thanks.
>

-- 
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 https://groups.google.com/group/sage-devel.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/9b2c316e-b601-4e14-af28-0eef2cb4d189%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to