How do Fractions convert to ints when they have no __int__ method?

py> from fractions import Fraction
py> x = Fraction(99, 2)
py> int(x)  # works fine
49
py> x.__int__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Fraction' object has no attribute '__int__'




-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to