On 2017-08-12 12:10, Daniel Krenn wrote:
> On 2017-08-12 11:14, Volker Braun wrote:
>> Caches from @cached_method are pickled by default, but the class can
>> opt-out of this. Sometimes this is necessary to make pickling work (not
>> every Cython object is pickle-able).
> 
> Hmmm....shouldn't the below work then?
> 
> sage: class A(SageObject):
> ....:     @cached_method
> ....:     def a(self):
> ....:         print('oo')
> ....:         return 42
> ....:
> sage: a = A()
> sage: a.a()
> oo
> 42
> sage: a.a()
> 42
> sage: save(a, 'a.sobj')
> sage: b = load('a.sobj')
> sage: b.a()  # again "computes" 42
> oo
> 42
> 

Indeed there is
    @cached_method(do_pickle=True)
...and this is used for Groebner basis in the ideal. So all my problems
are solved :)



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

Reply via email to