On Tue, Feb 3, 2009 at 11:40 AM, prasad rao <[email protected]> wrote: > hi >>>> a=2.1 >>>> a%1==True > False >>>> a%1==False > False >>>> b=3.8 >>>> b%1==True > False >>>> b%1==False > False > If it gives correct bool, it could be put to good use.
== gives a high degree of equality. In your idea, it would not be a kind of equality at all, because you would have: >>> 1 == True True >>> 2 == True True >>> 1 == 2 False It would also be confusion as to when '==' would mean logical equality and when real equality: >>>> 1 == ((0 == 0) or not (0==0)) True >>>> 1 == ((0 + 0) * (0 + 0)) False >>>> True == 1 ??? Finally, it is rarely necessary: >>> a=2.1 >>> bool(a%1)==True True That's a few characters more, but to me that's more than compensated by the gains in clarity and consistency (== is an equivalence relationship, at least unless you have redefined it for your own class in a less practical way) -- André Engels, [email protected] _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
