[Numpy-discussion] setmember1d: docstring vs. code
Sat Mar 10 13:26:59 CST 2007
Jouni K. Seppänen wrote:
> I think that either the docstring (and the book) should be corrected
> to mention the assumption, or the code should be made to work in the
> arbitrary case.
This is the current docstring:
In : setmember1d?
Base Class: <type 'function'>
Definition: setmember1d(ar1, ar2)
Return a boolean array of shape of ar1 containing True where the elements
of ar1 are in ar2 and False otherwise.
Use unique1d() to generate arrays with only unique elements to use as inputs
to this function.
- `ar1` : array
- `ar2` : array
- `mask` : bool array
The values ar1[mask] are in ar2.
numpy.lib.arraysetops has a number of other functions for performing set
operations on arrays.
> I would prefer the latter choice (but perhaps the
> current code has some advantages).
Well, it has the advantage of existing. If you have an implementation that is
just as efficient, but works for general arrays, I'd love to see it.
"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