[Numpy-discussion] Release blockers for 1.4.0 ?

David Cournapeau david@ar.media.kyoto-u.ac...
Mon Dec 7 22:54:39 CST 2009

josef.pktd@gmail.com wrote:
> warning is no problem, but I haven't figured out what the pattern is
> for repeated warnings.

By default, warnings are only 'raised' once. You need to use the
standard warnings module to control the behavior (always warn, raise,
etc...). Look for the simplefilter function in the python documentation
for the details.

Now, it is not that simple because the divide by zero is not a python
warning, but a simple printf on stderr if I understand  correctly what
Pauli said.

> When I do the same zero division several times, I only get the warning
> the first time, after that no warning is printed anymore. I don't know
> about the scope of the non-printing. If it is globally, so that only
> the first warning is printed, then it won't really help in detecting
> errors. ?

Both FPU exception handling and warning handling can be set up locally -
it is just a bit tricky to do because it should be considered as a
resource to be freed, that is it should always be restored to the
previous state no matter what. That's what context manager (with the
with keyword) are for in python >=2.6, and you should use try/finally
block otherwise.



More information about the NumPy-Discussion mailing list