The canonical thing to do is x_new = where(smth, foo, x) will do, but then foo has to be constructed differently (to be of the same shape as x, so this is in fact similar to x[smth] = foo[smth] out of place).