Why doesn't fractions.Fraction have __int__ method?

58 views Asked by At

When using int(fractions.Fraction), it returns the corresponding value of the fraction.

Example

from fractions import Fraction

int(Fraction(12, 3)) # Outputs 4

However, fraction.Fraction doesn't have an __int__ method. So how is this happening?

0

There are 0 answers