summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-04-26 17:14:25 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-04-26 17:14:25 +0000
commit6a720229ed41099a47ea8f94ca10bcdeee8f898d (patch)
tree8e58a33d064e53e21fbc40970adf902022e61691 /numpy/lib/function_base.py
parente328ecf10f570df8900438ec9e727b3af68c7f84 (diff)
downloadnumpy-6a720229ed41099a47ea8f94ca10bcdeee8f898d.tar.gz
Slightly different fix to vectorize.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 2b7041422..755a182e6 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -616,20 +616,10 @@ class vectorize(object):
self.lastcallargs = nargs
if self.nout == 1:
- ret = self.ufunc(*args)
- c = self.otypes[0]
- try:
- return ret.astype(c)
- except AttributeError: # scalar-case
- return array(ret).astype(c)
+ return asarray(self.ufunc(*args)).astype(self.otypes[0])
else:
- ret = []
- for x, c in zip(self.ufunc(*args), self.otypes):
- try:
- ret.append(x.astype(c))
- except AttributeError:
- ret.append(array(x).astype(c))
- return tuple(ret)
+ return tuple([asarray(x).astype(c) \
+ for x, c in zip(self.ufunc(*args), self.otypes)])
def cov(m,y=None, rowvar=1, bias=0):
"""Estimate the covariance matrix.