[Numpy-discussion] finding elements that match any in a set
robert.kern at gmail.com
Sat May 28 15:46:32 EDT 2011
On Sat, May 28, 2011 at 14:40, Michael Katz <michaeladamkatz at yahoo.com> wrote:
> Thanks for the explanation. It sounds like Python needs __rcontains__.
Not really. For the mathematical operators, there are good ways for
the operands to "know" what types they can deal with and which they
can't. For mylist.__contains__(x), it should treat all objects exactly
the same: check if it equals any item that it contains. There is no
way for it to say, "Oh, I don't know how to deal with this type, so
I'll pass it over to x.__contains__()".
A function call is the best place for this operation, not syntax.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion