Это можно сделать с помощью дескриптора . В следующем классе используются специальные методы, которые имеют особый эффект, когда этот класс создается в теле класса.
class SuperCaller:
def __set_name__(self, owner, name):
"""Called when the class is defined. owner is the class that's being
defined. name is the name of the method that's being defined.
"""
method = getattr(super(owner, owner), name)
def call(self, other):
# Note that this self shadows the __set_name__ self. They are two
# different things.
return type(self)(method(self, other))
self._call = call
def __get__(self, instance, owner):
"""instance is an instance of owner."""
return lambda other: self._call(instance, other)
class A(int):
__add__ = SuperCaller()
x = A()
print(type(x + 1))
Вывод: <class '__main__.A'>