<p dir="ltr">On Apr 8, 2015 2:16 PM, "Andreas Hilboll" <<a href="mailto:lists@hilboll.de">lists@hilboll.de</a>> wrote:<br>
><br>
> Hi all,<br>
><br>
> I'm commonly using function signatures like<br>
><br>
> def myfunc(a, b, c=None):<br>
> if c is None:<br>
> # do something ...<br>
> ...<br>
><br>
> where c is an optional array argument. For some time now, I'm getting a<br>
><br>
> FutureWarning: comparison to `None` will result in an elementwise<br>
> object comparison in the future<br>
><br>
> from the "c is None" comparison. I'm wondering what would be the best<br>
> way to do this check in a future-proof way?</p>
<p dir="ltr">As far as I know, you should be getting the warning when you write<br>
c == None<br>
and the fix should be to write<br>
c is None<br>
instead. (And this is definitely an important fix -- it's basically a bug in numpy that the == form ever worked.) Are you certain that you're getting warnings from 'c is None'?</p>
<p dir="ltr">-n</p>