class MyStr(str):
def __lt__(self, other):
print "__lt__",
return NotImplemented
def __gt__(self, other):
print "__gt__",
return NotImplemented
def __cmp__(self, other):
print "__cmp__ called"
return cmp(int(self), int(other))
MyStr("0") > MyStr("1")
Y2xhc3MgTXlTdHIoc3RyKToKICAgIGRlZiBfX2x0X18oc2VsZiwgb3RoZXIpOgogICAgICAgIHByaW50ICJfX2x0X18iLAogICAgICAgIHJldHVybiBOb3RJbXBsZW1lbnRlZAogICAgZGVmIF9fZ3RfXyhzZWxmLCBvdGhlcik6CiAgICAgICAgcHJpbnQgIl9fZ3RfXyIsIAogICAgICAgIHJldHVybiBOb3RJbXBsZW1lbnRlZAogICAgZGVmIF9fY21wX18oc2VsZiwgb3RoZXIpOgogICAgICAgIHByaW50ICJfX2NtcF9fIGNhbGxlZCIKICAgICAgICByZXR1cm4gY21wKGludChzZWxmKSwgaW50KG90aGVyKSkKCk15U3RyKCIwIikgPiBNeVN0cigiMSIp