Pierre GM wrote: > If you need your inputs to be array or scalar and stay that way
It didn't sound like the OP wanted that. I suspect that what is wanted if for to always be a 1-d array (i.e. vector). To do that, I'd do: import numpy as N >>> def test(a): ... b = N.asarray(a, dtype=N.float).reshape((-1,)) ... print b.shape ... >>> >>> test(5) (1,) >>> test((5,)) (1,) >>> test((5,6,7,8)) (4,) -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
