> Even if it's unlikely to happen, y[cond] might become a view of y and thus y
> will be overwritten. So, on a second thought, I think it would be safer to
> always allocate y_binary with np.empty (i.e., remove the if statement).

I had the same thing in mind when writing the code. I didn't want to
change the existing behavior, but I agree with you and I will implement
your suggestion.