[Numpy-discussion] proper use of __new__
Tue Jul 21 13:42:03 CDT 2009
On Jul 21, 2009, at 2:23 PM, Darren Dale wrote:
>> Without access to your code, I'm likely to speak beyond myself here
>> (could you send me a link to the latest version ?), but if you need
>> rescale the units, make sure it's done in __array_finalize__ as well,
>> with something like
>> units = getattr(obj, 'units', None)
>> if units is not None:
>> self.units = units
> Thanks for the suggestion, but I don't think there would be a reason
> to rescale when taking a view. view only takes dtype and type
> arguments, there is no way to specify what units you want to convert
I understand that very well, but could there be a case where some
discrepancy between units may arise, so that obj and self no longer
have the same units ? But once again, it's pure conjecture from my
part at this point.
> For some reason, I am not able to browse the repository at launchpad,
> but you can get the code with "bzr branch lp:python-quantities" or
> from http://pypi.python.org/pypi/quantities .
Cool, thx. I'll check that in the next few hours/days...
More information about the NumPy-Discussion