You can figure out a lot about a class given an example of its use. From
the sample output of using our imagined Fraction class we can tell that:
>>> d1 = Fraction(2,5)
>>> print d1
2/5 >>> print d1
__str__ method for display.>>> d2 = Fraction(4)
4/1
Fraction it constructs.>>> d3 = d1 + d2
__add__ function.>>> if d1 <= d2:
__le__ method.>>> print d1[0], d1[1]
__getitem__ method.>>> print d1 + 2
__add__ method works when the second argument
is an integer and not another Fraction.>>> print d1 - 2
__sub__ and like __add__,
__sub__ works with integer values as well as Fraction values.