[Numpy-discussion] trouble subclassing ndarray
Wed Dec 3 09:43:59 CST 2008
2008/12/3 Kevin Jacobs <email@example.com> <firstname.lastname@example.org>:
> On Wed, Dec 3, 2008 at 9:19 AM, Sébastien Barthélemy <email@example.com>
>> def inv_v1(self):
>> self[0:4,0:4] = htr.inv(self)
>> def inv_v2(self):
>> data = htr.inv(self)
>> self = HomogeneousMatrix(data)
>> def inv_v3(self):
>> self = htr.inv(self)
> self is a reference, so you're just overwriting it with references to new
> values in v2 and v3. The original object is unchanged. Only v1 changes
> self. You may want to use "self[:] = ....".
okay, it seems obvious now. I definitely spent to much time with matlab.
More information about the Numpy-discussion