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

Friedrich Romstedt friedrichromstedt@gmail....
Thu Feb 11 15:32:55 CST 2010


2010/2/11 Keith Goodman <kwgoodman@gmail.com>:
> The problem I have now is that I don't know where to place the line of
> code that changes the meaning of numpy's equal. I don't know when
> someone will do

Well, I think a solution is as written before to put a test whether
the other operand is in fact a myclass instance.  If not, proceed with
numpy's original ops.  Then it should be safe to place the overload in
the module's code directly, altough it makes numpy a bit slower at
all.

Or you offer Robert's solution for the with statement, but I think if
someone imports your module he should accept that numpy's ops get
overloaded permanently.

Friedrich


More information about the NumPy-Discussion mailing list