I have a function that takes the argument NBins. I want to make a call to this function with a scalar 50 or an array [0, 10, 20, 30]. How can I identify within the function, what the length of NBins is? or said differently, if it is a scalar or a vector?
I tried this:
>>> P = 5
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: object of type 'int' has no len()
As you see, I can't apply len to P, since it's not an array... Is there something like isarray or isscalar in python?