Can please someone explain how one may use 'is' in an 'if' condition. I am working with the fractions module, and I'm having some trouble:
>>> Fraction(0, 1) is 0
False
>>> float(Fraction(0, 1))
0.0
>>> float(Fraction(0,1)) is 0.0
False
The only thing I found to work is:
>>> F = Fraction(a,b)
>>> if F >= 0:
... if F(0, 1) <= 0:
... ...
Is there a way to use 'is' here? Thanks.