def rat(num, den = 1):
    # must check complex before float
    if isinstance(num, complex) or isinstance(den, complex):
        # numerator or denominator is complex: return a complex
        return complex(den) / complex(num)
    if isinstance(num, float) or isinstance(den, float):
        # numerator or denominator is float: return a float
        return float(num) / float(den)
    # otherwise return a rational
    return Rat(num, den)
dataset/ETHPy150Open robmoggach/python-moshion/moshion/extractframes/Rat.py/rat/swapped operands of `/`