[Numpy-discussion] FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.

Andreas Hilboll lists at hilboll.de
Tue Apr 7 11:14:45 EDT 2015


Hi all,

I'm commonly using function signatures like

   def myfunc(a, b, c=None):
       if c is None:
           # do something ...
       ...

where c is an optional array argument.  For some time now, I'm getting a

   FutureWarning: comparison to `None` will result in an elementwise
   object comparison in the future

from the "c is None" comparison.  I'm wondering what would be the best
way to do this check in a future-proof way?

Best,
-- Andreas.



More information about the NumPy-Discussion mailing list