[SciPy-user] Vectorize vs Map

Robert Kern robert.kern@gmail....
Thu Mar 15 12:04:07 CDT 2007

Lorenzo Isella wrote:
> Dear All,
> Probably another newbie question: I like quite a lot the vectorize()
> command which allows me to skip iterations on functions, but the map()
> command on a list performs a similar task if I am not mistaken.
> Is there any reason to favour one above the other or is it just a
> matter of taste?

vectorize() takes a Python function and turns it into a ufunc. ufuncs do a lot
more than map() does. They can take multidimensional arrays. n-ary ufuncs can
take multiple inputs and broadcast them against each other. ufuncs have methods
like .inner() and .reduce() which are quite powerful.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the SciPy-user mailing list