If numpy.any()
returns True
the comparison with is True
fails but with == True
works. Does anyone know why?
A minimal example
from __future__ import print_function
import numpy
a = numpy.array([True])
if a.any() == True:
print('== works')
if a.any() is True:
print('is works')
The output of this code is just == works
.