[Numpy-discussion] different behaviour in asfarray(None)

lorenzo bolla lbolla@gmail....
Tue Apr 22 10:07:36 CDT 2008


I noticed a change in the behaviour of numpy.asfarray between numpy version
1.0.5 and 1.1.0:

1.0.5
====

In [3]: numpy.asfarray(None)
Out[3]: array(nan)
In [4]: numpy.__version__
Out[4]: '1.0.5.dev4455'

1.1.0
====

In [16]: numpy.asfarray(None)
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call last)

c:\Documents and Settings\bollalo001\My
Documents\archive\python\openopt\<ipython console> in <module>()

c:\Python25\Lib\site-packages\numpy\lib\type_check.py in asfarray(a, dtype)
     47     if not issubclass(dtype, _nx.inexact):
     48         dtype = _nx.float_
---> 49     return asarray(a,dtype=dtype)
     50
     51 def real(val):

c:\Python25\Lib\site-packages\numpy\core\numeric.py in asarray(a, dtype,
order)
    133     are converted to base class ndarray.
    134     """
--> 135     return array(a, dtype, copy=False, order=order)
    136
    137 def asanyarray(a, dtype=None, order=None):

<type 'exceptions.TypeError'>: float() argument must be a string or a number

In [17]: numpy.__version__
Out[17]: '1.1.0.dev5061'


Is this intended? why?

L.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080422/1d8f3fbf/attachment.html 


More information about the Numpy-discussion mailing list