Comparison with boolean numpy arrays VS PEP8 E712
问题 PEP8 E712 requires that "comparison to True should be if cond is True: or if cond: ". But if I follow this PEP8 I get different/wrong results. Why? In [1]: from pylab import * In [2]: a = array([True, True, False]) In [3]: where(a == True) Out[3]: (array([0, 1]),) # correct results with PEP violation In [4]: where(a is True) Out[4]: (array([], dtype=int64),) # wrong results without PEP violation In [5]: where(a) Out[5]: (array([0, 1]),) # correct results without PEP violation, but not as