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

Friedrich Romstedt friedrichromstedt@gmail....
Thu Feb 11 14:21:23 CST 2010


Hi Keith,

2010/2/11 Keith Goodman <kwgoodman@gmail.com>:
> Is there some way to tell numpy to use my __eq__ instead of its own?
> That would solve my problem. I had a similar problem with __radd__
> which was solved by setting __array_priority__ = 10. But that doesn't
> work in this case.

It's quite simple, but hidden in the forest of documentation (though
it mentiones it, and quite in detail).

Use:

numpy.set_numeric_ops(equal = my_equal_callable_object)

Note that you should _not_ simply use a function:

def equal(a, b):


2010/2/11 Keith Goodman <kwgoodman@gmail.com>:
> I wish I knew enough to reply to your post. Then I could return the
> favor. You'll have to settle for a thank you. Thank you.
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list