While I was working with Python,
>>> [attr for attr in dir(1) if not attr.startswith('_')]
['bit_length', 'conjugate', 'denominator', 'imag', 'numerator', 'real']
>>> [attr for attr in dir(1.1) if not attr.startswith('_')]
['as_integer_ratio', 'conjugate', 'fromhex', 'hex', 'imag', 'is_integer', 'real']
Although I understand that “conjugation”, “imagination” and “reality” exist for compatibility with a complex type, I can’t understand why the “numerator” and “denominator” exist only for int, and don’t for float.
Any explanation for this?
source
share