[Numpy-discussion] small suggestion for numpy.testing utils

Stéfan van der Walt stefan at sun.ac.za
Sun Feb 22 19:02:25 EST 2009


2009/2/23 Darren Dale <dsdale24 at gmail.com>:
> On Sun, Feb 22, 2009 at 5:12 PM, Stéfan van der Walt <stefan at sun.ac.za>
> wrote:
>>
>> Hi Darren
>>
>> 2009/2/22 Darren Dale <dsdale24 at gmail.com>:
>> > I am using numpy's assert_array_equal and assert_array_almost_equal to
>> > unit
>> > test my physical quantities package. I made a single minor change to
>> > assert_array_compare that I think might make these functions more useful
>> > to
>> > ndarray subclasses, and thought maybe they could be useful to numpy
>> > itself.
>>
>> Your patch makes good sense.  I applied it in r6457.  I'll keep an eye
>> on the thread to see if anyone else has further comments.
>
> Pierre just drew my attention to asanyarray, I think that would have been a
> better choice for my patch.

Asanyarray is just

    return array(a, dtype, copy=False, order=order, subok=True)

with default values for dtype=None and order=None.  I think your
original suggestion more clearly shows what the function is meant to
achieve.

Cheers
Stéfan



More information about the NumPy-Discussion mailing list