Message390601
The behaviour of `is` is correct.
The `is` operator tests for object identity, not equality. The reason that `slice(None) is slice(None)` returns False is that the two calls to the slice function return two different objects.
You say that using the equals operator `==` "doesn't return a single Boolean if a is a NumPy array", that is a design flaw in numpy, and there is nothing we can do about it.
You could try something like this:
def equal(a, b):
flag = (a == b)
if isinstance(flag, bool):
return flag
else:
return all(flag) |
|
Date |
User |
Action |
Args |
2021-04-09 09:57:38 | steven.daprano | set | recipients:
+ steven.daprano, nschloe |
2021-04-09 09:57:38 | steven.daprano | set | messageid: <1617962258.69.0.0955993464129.issue43786@roundup.psfhosted.org> |
2021-04-09 09:57:38 | steven.daprano | link | issue43786 messages |
2021-04-09 09:57:38 | steven.daprano | create | |
|