[Numpy-discussion] Inconsistent error messages.

Stéfan van der Walt stefan at sun.ac.za
Sat May 23 21:06:28 EDT 2009


2009/5/24 Eric Firing <efiring at hawaii.edu>:
>> OK, that would work. Although I think a named argument might be a more
>> transparent way to specify behaviour than setting the warnings.
>
> I agree; using a warning strikes me as an abuse of the warnings
> mechanism.  Instead of a "strict" flag, which I find not particularly
> expressive--what is it being "strict" about?--how about a "min_count"
> kwarg to go with the existing "count" kwarg?

Warnings are a great way of telling the user that a non-fatal problem
cropped up.  It isn't easy to send information along with an
exception, so I don't think raising an error here is ever particularly
useful.

Maybe we should provide tools in NumPy to handle warnings more easily?
 Something like

with no_warnings:
    np.fromfile('x')

or

with raise_warnings:
    np.fromfile('x')

?

Regards
Stéfan



More information about the NumPy-Discussion mailing list