3 ms·
This gets ugly with !=. Instead of 'a != b' you usually want 'not (a == b).all()'.
by kevin_thibedeau 4y ago
This gets ugly with !=. Instead of 'a != b' you usually want 'not (a == b).all()'.
- cuteboy19 4y agoIt really doesn't if you think about it. a==b cannot by itself be used as an if condition. You would always need to use (a==b).all(). So it would be very difficult to make the mistake you are suggesting https://stackoverflow.com/questions/10062954/valueerror-the-truth-value-of-an-array-with-more-than-one-element-is-ambiguous https://stackoverflow.com/questions/10062954/valueerror-the-...
- IshKebab 4y agoI think the general point is that it was a bad idea to implement the operators as elementwise because it breaks all of the properties they are supposed to hold. Really there should be separate elementwise operators like `.>` and so on but you can only do that in some languages.