[Numpy-discussion] logical masking, wrong length mask

Stéfan van der Walt stefan@sun.ac...
Wed May 28 09:39:23 CDT 2008


2008/5/28 John Hunter <jdh2358@gmail.com>:
> I initially thought line 24 below should raise an error, or coerce
> True to 1 and False to 0 and give me either y[0] or y[1] accordingly,
> but neither appear to be happening.  Instead, I appear to be getting
> y[:len(mask)][mask]

This "feature" looks dangerous enough to warrant raising a warning.
Is a good reason
why it works in the first place?

Regards
Stéfan


More information about the Numpy-discussion mailing list