pymi_operator_overload.py
class MyInt():
def __init__(self, n):
self.n = n
def __add__(self, k):
return (self.n + k.n) * 2
two = MyInt(2)
three = MyInt(3)
print(two + three == 10)INFO
class MyInt():
def __init__(self, n):
self.n = n
def __add__(self, k):
return (self.n + k.n) * 2
two = MyInt(2)
three = MyInt(3)
print(two + three == 10)