I made a custom mathematical object (Fractions) that can use some operators (for ex. '+' thanks to__add__()
)
This means my Fraction can work with ints:
Fraction(1/2) + 0.5 == 1 # True
I would like ints and floats to work with my object as well. for example:
0.5 + Fraction(1/2) == 1 # Error, not supported...
How do I make my object work with built-in objects?