[Numpy-discussion] unexpected behavior with allclose( scalar, empty array)

Matthew Brett matthew.brett at gmail.com
Thu Jan 3 16:22:12 EST 2008


Hi,

> > > import numpy as np
> > > print np.__version__
> > > a=np.int32(42)
> > > b=np.array([],dtype=np.int32)
> > > assert np.allclose(a,b)
> > >
> > > Is this expected behavior of numpy or is this a bug I should report?
> >
> > Bug, I think.

I think this bug - which may be mine - follows from this line in allclose:

return all(less_equal(absolute(x-y), atol + rtol * absolute(y)))

and:

In [39]: all([])
Out[39]: True

Matthew



More information about the NumPy-Discussion mailing list