[SciPy-user] single elements and arrays

Gideon Simpson grs2103@columbia....
Mon Jun 30 12:45:29 CDT 2008


Suppose I have a function foo

def foo(x):
	blah

and i have written foo in a vectorized fashion such that x can be a  
numpy array of #'s.  But suppose I also want to be able to do

foo(5.5)

where i am interested in the value at a single point.

Is there an easy way to handle both cases?  Should I just not permit  
this sort of ambiguity (force everything to be an array)?


-gideon



More information about the SciPy-user mailing list