[Numpy-discussion] extract elements of an array that are contained in another array?

David Warde-Farley dwf@cs.toronto....
Fri Jun 5 02:10:59 CDT 2009


On 4-Jun-09, at 4:38 PM, Anne Archibald wrote:

> It seems to me that this is the basic source of the problem. Perhaps
> this can be addressed? I realize maintaining compatibility with the
> current behaviour is necessary, so how about a multistage deprecation:
>
> 1. add a keyword argument to intersect1d "assume_unique"; if it is not
> present, check for uniqueness and emit a warning if not unique
> 2. change the warning to an exception
> Optionally:
> 3. change the meaning of the function to that of intersect1d_nu if the
> keyword argument is not present
>
> One could do something similar with setmember1d.

+1 on this idea. I've been bitten by the non-unique stuff in the past,  
especially with setmember1d, not realizing that both need to be unique.

David


More information about the Numpy-discussion mailing list