3 ms·
It’s the array accessing that is overloaded. a > 5 is a boolean array with the same dimension as a, and now the overloaded method for array access gets called w
by niklasbuschmann 6y ago
It’s the array accessing that is overloaded. a > 5 is a boolean array with the same dimension as a, and now the overloaded method for array access gets called with this boolean array.
I also found it incredibly confusing the first time I saw this, but like all the numpy magic based on overloading, it’s confusing the first time you see it, but incredibly handy afterwards.
- metalrain 6y agoThat kind of makes sense. You use logical expressions to build mask that you use to generate view in the outer expression.