def my(self, attr):
    try:
        return object.__getattr__(self, attr)
    except AttributeError:
        return 0


def implicit_int(cls):
    cls.__getattr__ = my
    return cls


@implicit_int
class A:
    pass


a = A()
print(a.e)