[Numpy-discussion] Deprecation of boolean substract and negative (the - operator)

sebastian sebastian at sipsolutions.net
Thu Jan 30 06:02:10 EST 2014


Hey all,

recently we had a small discussion about deprecating some of the 
operators for boolean arrays. This discussion seemed to have ended by 
large in the consense that while most boolean operators are well defined 
and should be kept, the `-` one is not very well defined on boolean 
arrays and has the problem of the inconsistency:

- np.array(False) == True
False - np.array(False) == False
# leading to:
False - (-np.arry(False)) != False + np.array(False)

So that it is preferable to use one of the binary operators for this 
operation.

For now this would only be a deprecation, but both operators are 
probably used out there. So if you have any serious doubt about starting 
this deprecation please note it here.

The Pull request to implement such a deprecation is: 
https://github.com/numpy/numpy/pull/4105

Regards,

Sebastian



More information about the NumPy-Discussion mailing list