np.isscalar (I think) checks to see if you have a number or an array. Though it doesn't check if it's 0-dim array ...