[SciPy-user] different behaviour in asfarray(None) effects scikits.openopt

lorenzo bolla lbolla@gmail....
Tue Apr 22 10:43:44 CDT 2008


numpy.asfarray(None) behaviour from numpy version 1.0.5 to 1.1.0 breaks
scikits.openopt: in particular the file
scikits/openopt/Kernel/BaseProblem.py

a possible patch is as follows:

$ diff BaseProblem.py.orig BaseProblem.py
120c120
<         self.x0 = None
---
>         self.x0 = nan

L.




On Tue, Apr 22, 2008 at 5:29 PM, Stéfan van der Walt <stefan@sun.ac.za>
wrote:

> 2008/4/22 lorenzo bolla <lbolla@gmail.com>:
> > 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'>: float() argument must be a string or a
> number
> >
> > Is this intended? why?
>
> Yes, 'asfarray' is equivalent to
>
> array(input).astype(dtype)
>
> I think it would be wrong to assume that None means NaN.
>
> Cheers
> Stéfan
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
Lorenzo Bolla
lbolla@gmail.com
http://lorenzobolla.emurse.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080422/e3e40715/attachment.html 


More information about the SciPy-user mailing list