``if ans.size == 1:`` looks better for ndarrays.