numpy/numpy — pull request #3951 by seberg (2013-10-19 18:08:51+00:00)
Title: ENH: Add scalar special cases to Priority getter

Exact Python scalars can never have a priority, but checking
it is expensive. This adds checks for these to the Priority
getter function.

-

Not sure if adding the special case at that point is ideal. For most/all other branches the scalars were probably already ruled out by the time calling this, so might also the special case down the iteration loop.

This should fix the slowdown of `a = np.array(1); a + 1.` when comparing master to 1.7.