[Numpy-discussion] Scalar-ndarray arguments passed to not_equal

Keith Goodman kwgoodman at gmail.com
Thu Feb 11 15:40:58 EST 2010


On Thu, Feb 11, 2010 at 12:32 PM, Friedrich Romstedt
<friedrichromstedt at gmail.com> wrote:
>> Hey! You broke my numpy  :)
>>
>>>> def addbug(x, y):
>>   ...:     return x - y
>>   ...:
>>>> old_funcs = np.set_numeric_ops(add=addbug)
>>>> np.array([1]) + np.array([1])
>>   array([0])
> Yea, that's what I meant.  Great.
>
> :-) :-)

Who needs to type np.dot when you can do:

>> def dotmult(x, y):
   ....:     return np.dot(x, y)
   ....:
>> old_funcs = np.set_numeric_ops(multiply=dotmult)
>>
>> np.array([1, 2, 3]) * np.array([1, 2, 3])
   14

I can see many bugs coming my way...



More information about the NumPy-Discussion mailing list