[Numpy-discussion] logical masking, wrong length mask

Stéfan van der Walt stefan at sun.ac.za
Wed May 28 10:39:23 EDT 2008


2008/5/28 John Hunter <jdh2358 at 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