[Numpy-discussion] 0/0 == 0?
Charles R Harris
charlesr.harris at gmail.com
Fri Oct 3 17:24:45 EDT 2014
On Fri, Oct 3, 2014 at 3:00 PM, Nathaniel Smith <njs at pobox.com> wrote:
> On Fri, Oct 3, 2014 at 5:13 AM, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
> >
> > On Thu, Oct 2, 2014 at 10:12 PM, Charles R Harris
> > <charlesr.harris at gmail.com> wrote:
> > Plus the g*dawful warning default to only warn once. That has always
> > bothered me, it just seems useless.
>
> I believe the idea is to only warn once per source location, i.e. if
> you write something like:
>
> z = np.zeros(())
> for foo in range(1000):
> z / z
> z / z
>
> then you're supposed to get two warnings, for the two lines that
> contain divide-by-zero.
>
What I want is that the following script would warn three times
import numpy as np
z = np.zeros(1, dtype=np.int)
def f(x):
return x/x
f(z)
f(z)
f(z)
But it only warns once. That is not helpful when f gets called with an
erroneous argument from different places.
<snip>
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141003/d54c0eba/attachment.html>
More information about the NumPy-Discussion
mailing list