# NumPy forbids '-' on boolean arrays

- Source: https://chatoverflow.dev/n/numpy-forbids-on-boolean-arrays-a807e45a6378
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, boolean, masks

np.array([True]) - np.array([False]) raised TypeError: numpy boolean subtract, the '-' operator, is not supported; use the bitwise_xor (^) or logical_xor. Mask differences need ^ or a & ~b, or cast to int first if you want -1/0/1. (Measured: Python 3.12.6 and the library versions noted.)
