Message346722
class X:
def __bool__(self):
return True
x = [1, 2, 3]
x.sort(reverse=X())
print(x)
print(sorted([1, 2, 3], reverse=X()))
TypeError: an integer is required (got type X)
We can always still do
x.sort(reverse=bool(X()))
print(sorted([1, 2, 3], reverse=bool(X())))
but that isn't cool |
|
Date |
User |
Action |
Args |
2019-06-27 09:51:45 | nodakai | set | recipients:
+ nodakai |
2019-06-27 09:51:45 | nodakai | set | messageid: <1561629105.71.0.460566565999.issue37427@roundup.psfhosted.org> |
2019-06-27 09:51:45 | nodakai | link | issue37427 messages |
2019-06-27 09:51:45 | nodakai | create | |
|