@pv said

> I think the right thing to do would be to fix this in Numpy, rather than hacking around it.

Both can be done.  Even if the problem is fixed in Numpy, we're stuck with the poor performance of all the older supported versions of Numpy.

I realize the net performance gain for the whole function is only 5% or so, but it pains me to undo such an easy gain of 5%. :)  Does one `if` statement really degrade the "readability" *that* much?