Re: [Numpy-discussion] Possible to pickle new state in NDArray subclasses?

2016-12-14 Thread Nathan Goldbaum
I'm able to do this in my ndarrary subclass using __reduce__ and __setstate__: https://bitbucket.org/yt_analysis/yt/src/yt/yt/units/yt_array.py#yt_array.py-1250 Here it's being used to save the unit information into the pickle for a unit-aware ndarray subclass. On Wed, Dec 14, 2016 at 1:45 PM,

[Numpy-discussion] Possible to pickle new state in NDArray subclasses?

2016-12-14 Thread Stuart Reynolds
I'm trying to subclass an NDArray as shown here: https://docs.scipy.org/doc/numpy/user/basics.subclassing.html My problem is that when I save the new class' state with pickle, the new attributes are lost. I don't seem to be able to override __getstate__ or __setstate__ to achieve this? Is it