[Numpy-discussion] Warnings in NumPy SVN

David M. Cooke cookedm at physics.mcmaster.ca
Thu Apr 27 11:30:05 EDT 2006


Fernando Perez <Fernando.Perez at colorado.edu> writes:

> Sasha wrote:
>> On 4/27/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>>
>>>[...]
>>>The function (or macro) needs to implement the operation on the basic
>>>data-type and if necessary set an error-flag in the floating-point
>>>registers.
>>>
>>>If anybody has time to help implement these basic operations, it would
>>>be greatly appreciated.
>> I can help.  To make sure we don't duplicate our effort, let's do
>> the following:
>> 1. I will add place-holders for all the necessary functions to make
>> them return "NotImplemented".
>
> just a minor reminder:
>
>   raise NotImplementedError
>
> is the standard idiom for this.

Just a note: For __xxx__ methods, "return NotImplemented" is the
standard idiom. See section 3.3.8 (Coercion rules) of the Python 2.4
language manual:

   For most intents and purposes, an operator that returns
   NotImplemented is treated the same as one that is not implemented
   at all.

I believe the idea is that it's not actually an error for an __xxx__
method to not be implemented, as there are fallbacks.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca




More information about the NumPy-Discussion mailing list