Another case where refusing to implicitly create object arrays would have avoided a lot of confusion...

On Aug 10, 2015 10:13 AM, "Sebastian Berg" <sebastian@sipsolutions.net> wrote:
On Mo, 2015-08-10 at 12:09 -0400, Benjamin Root wrote:
> Just came across this one today:
>
> >>> np.in1d([1], set([0, 1, 2]), assume_unique=True)
> array([ False], dtype=bool)
>
> >>> np.in1d([1], [0, 1, 2], assume_unique=True)
>
> array([ True], dtype=bool)
>
>
> I am assuming this has something to do with the fact that order is not
> guaranteed with set() objects? I was kind of hoping that setting
> "assume_unique=True" would be sufficient to overcome that problem.
> Should sets be rejected as an error?
>

Not really, it is "simply" because ``np.asarray(set([1, 2, 3]))``
returns an object array and 1 is not the same as ``set([1, 2, 3])``.

I think earlier numpy versions may have had "short cuts" for short lists
or something so this may have worked in some cases....

- Sebastian


>
> This was using v1.9.0
>
>
> Cheers!
>
> Ben Root
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion


_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion