Can I use ~A
to invert a numpy array of booleans, instead of the rather awkward functions np.logical_and()
and np.invert()
? Indeed, ~
seems to work fine, but I can't find it in any nympy reference manual, and - more alarmingly - it certainly does not work with scalars (e.g. bool(~True)
returns True
!), so I'm a little bit worried ...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…