Re: [sage-devel] A __reduce__ function handling **kwargs

2015-05-04 Thread Nils Bruin
On Monday, May 4, 2015 at 5:18:35 AM UTC-7, Nathann Cohen wrote: > > Yo ! > > > I guess it would be simpler to use __setstate__() in your use case. > > What is the difference between setstate and a helper function ? O_o > You should probably view the initial creation (whether it's a class cons

Re: [sage-devel] A __reduce__ function handling **kwargs

2015-05-04 Thread Jeroen Demeyer
On 2015-05-04 14:18, Nathann Cohen wrote: Yo ! I guess it would be simpler to use __setstate__() in your use case. What is the difference between setstate and a helper function ? Not much, only that __setstate__() is a cleaner design and that __getstate__() is easier to doctest than __redu

Re: [sage-devel] A __reduce__ function handling **kwargs

2015-05-04 Thread Nathann Cohen
Yo ! > I guess it would be simpler to use __setstate__() in your use case. What is the difference between setstate and a helper function ? O_o Nathann -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop recei

Re: [sage-devel] A __reduce__ function handling **kwargs

2015-05-04 Thread Jeroen Demeyer
On 2015-05-04 13:55, Nathann Cohen wrote: Something vaguely like that is possible using __getstate__ and __setstate__, see http://trac.sagemath.org/ticket/18109 Err.. Well, in my case the function I call is not the class' constructor. That doesn't matter. I ended up writing an unpickle funct

Re: [sage-devel] A __reduce__ function handling **kwargs

2015-05-04 Thread Nathann Cohen
> Something vaguely like that is possible using __getstate__ and __setstate__, > see http://trac.sagemath.org/ticket/18109 Err.. Well, in my case the function I call is not the class' constructor. Because of ... reasons :-P I ended up writing an unpickle function, which is more or less forwarding

Re: [sage-devel] A __reduce__ function handling **kwargs

2015-05-04 Thread Jeroen Demeyer
Something vaguely like that is possible using __getstate__ and __setstate__, see http://trac.sagemath.org/ticket/18109 -- 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

[sage-devel] A __reduce__ function handling **kwargs

2015-04-30 Thread Nathann Cohen
Hello everybody, I have a simple problem. I need to implement a __reduce__ function for pickling, and such a function must apparently return a pair: (f, args) You can then build the original object with "f(*args)". I would like to do the same, but with additional "keywords arguments", i.e.