[sage-devel] Re: A question on pickling cached methods

2019-07-02 Thread Kwankyu Lee
On Thursday, June 27, 2019 at 9:45:42 PM UTC+9, Simon King wrote: > > > I think if pickling doesn't preserve the content of the cached method > then it is a bug. > UniqueRepresentation objects do not preserve the content of the cached method with do_pickle=True. This problem is solved in htt

[sage-devel] Re: A question on pickling cached methods

2019-06-27 Thread Kwankyu Lee
> > From the code, I learned that there is "do_pickle" option. With > "do_pickle=True", the content of the cached method is indeed preserved with > an experimental class. I will check again with my production code. > I applied "do_pickle=True" option to F.weierstrass_points() with global funct

[sage-devel] Re: A question on pickling cached methods

2019-06-27 Thread Kwankyu Lee
On Thursday, June 27, 2019 at 10:20:55 PM UTC+9, Volker Braun wrote: > > 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

[sage-devel] Re: A question on pickling cached methods

2019-06-27 Thread Kwankyu Lee
On Thursday, June 27, 2019 at 9:45:42 PM UTC+9, Simon King wrote: > > Hi! > > Is it a Python object? > Yes. > A cached method (if that hasn't changed since I last looked at the code) > stores the cached values in some dict stored as an attribute, and when > you pickle the object (at least

[sage-devel] Re: A question on pickling cached methods

2019-06-27 Thread Volker Braun
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 va

[sage-devel] Re: A question on pickling cached methods

2019-06-27 Thread Simon King
Hi! Is it a Python object? A cached method (if that hasn't changed since I last looked at the code) stores the cached values in some dict stored as an attribute, and when you pickle the object (at least when no __reduce__ method interferes), it should automatically store that attribute. But you