On Wed, Jan 10, 2018 at 3:03 PM, Andrew Nelson <andyf...@gmail.com> wrote:
>
> Further to my last message, why is the warning only raised once?
>
> ```
> >>> import numpy as np
> >>> np.min([1, np.nan])
>
/Users/andrew/miniconda3/envs/dev3/lib/python3.6/site-packages/numpy/core/_methods.py:29:
RuntimeWarning: invalid value encountered in reduce
>   return umr_minimum(a, axis, None, out, keepdims)
> nan
> >>> np.min([1, np.nan])
> nan
> >>>
> ```

This is default behavior for warnings.

https://docs.python.org/3/library/warnings.html#the-warnings-filter

It also explains the previous results. The same warning would have been
issued from the same place in each of the variations you tried. Since the
warnings mechanism had already seen that RuntimeWarning with the same
message from the same code location, they were not printed.

--
Robert Kern
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to