[Numpy-discussion] NotImplementedType should be an exception

Charles R Harris charlesr.harris at gmail.com
Sat Jun 21 17:30:06 EDT 2008


On Sat, Jun 21, 2008 at 7:39 AM, Travis E. Oliphant <oliphant at enthought.com>
wrote:

> Charles R Harris wrote:
> > Shouldn't this raise an NotImplementedError exception?
> >
> > In [7]: type(remainder(complex192(1), complex192(1)))
> > Out[7]: <type 'NotImplementedType'>
> I'm not sure if it is relevant in this case but we do need to keep in
> mind that Python uses the NotImplementedType as a signal to hand off the
> calculation to the other object in a binary operation.
>
> If we change this here we may affect that behavior, unintentionally.
>

It doesn't change the behavior of any of the ufuncs with array/array
arguments. I need to write up comprehensive tests for the combinations of
array/scalars and scalars,scalars, but there don't seem to be problems there
either. Can I also suggest that we not promote arrays of numeric types to
arrays of objects? Is there some way of preventing this?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080621/32c4b19b/attachment.html>


More information about the NumPy-Discussion mailing list