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 [2]: setmember1d? Type: function Base Class: <type 'function'> Namespace: Interactive File: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.0.2.dev3569-py2.5-macosx-10.3-fat.egg/numpy/lib/arraysetops.py Definition: setmember1d(ar1, ar2) Docstring: 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. :Parameters: - `ar1` : array - `ar2` : array :Returns: - `mask` : bool array The values ar1[mask] are in ar2. :See also: 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. -- Robert Kern "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 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion