Python: avoiding fraction simplification
Question: I'm working on a music app' in Python and would like to use the fractions
module to handle time signatures amongst other things. My problem is that
fractions get simplified, i.e.:

    
    
    >>> from fractions import Fraction
    >>> x = Fraction(4, 4)
    >>> x
    Fraction(1, 1)
    

However, it is important from a musical point of view that 4/4 stays 4/4 even
though it equals 1. Is there any built-in way to avoid that behaviour?

Thanks!


Answer: Yes: make a custom class for it.

Musical time signatures are not fractions, so it doesn't make sense to
represent them with a math class.

