Message289434
And what about even wackier code like this?
class A(int):
def __lt__(self, other):
print("zebra")
A.__lt__ = A.__false_lt__
return int.__lt__(self, other)
__true_lt__ = __lt__
def __false_lt__(self, other):
print("gizmo")
A.__lt__ = A.__true_lt__
return int.__lt__(self, other)
[A(i) for i in range(20, 5, -1)].sort()
This alternates printing "zebra" and "gizmo" for every comparison, and there is no way to add some sort of caching without changing this behavior. |
|
| Date |
User |
Action |
Args |
| 2017-03-11 03:58:36 | ppperry | set | recipients:
+ ppperry, tim.peters, vstinner, serhiy.storchaka, mdk, elliot.gorokhovsky |
| 2017-03-11 03:58:36 | ppperry | set | messageid: <[email protected]> |
| 2017-03-11 03:58:36 | ppperry | link | issue28685 messages |
| 2017-03-11 03:58:36 | ppperry | create | |
|