class MyStr(str):

    def __gt__(self, other):
        print('(was called)', end=' ')
return int(self) > int(other)
print(MyStr(16) > MyStr(7))
Can you override a magic method when extending a builtin in python?