Scipy: vectorized function does not take scalars as arguments

Travis E. Oliphant oliphant.travis at ieee.org
Wed May 24 20:24:36 CEST 2006


ago wrote:
> Once I vectorize a function it does not acccept scalars anymore. Es
> 
> def f(x): return x*2
> vf = vectorize(f)
> print vf(2)
> 
> AttributeError: 'int' object has no attribute 'astype'
> 
> Is this the intended behaviour?
> 

Vectorize handles scalars in recent versions of NumPy.  Which version do 
you have?

-Travis





More information about the Python-list mailing list