
On Thu, Aug 9, 2012 at 10:15 AM, Antoine Pitrou <solipsis@pitrou.net> wrote:
Le 08/08/2012 16:28, Guido van Rossum a écrit :
I'd be strongly against changing that rule. If you don't want other
types than bool, use an isinstance check. Code using "is True" is most likely a bug. (It's different for None, since that has no second value that is assumed.)
That said, I'm also curious about the answer to Michael's following question: “why does it say that using an identity check is worse than an equality check?”
In python 3.2.3: >>> 1 == True True * >>> 13 == True* * False* >>> bool(1) True >>> bool(13) True >>> 1 is True False >>> 13 is True False To my surprise identity is actually less confusing than equality. So I agree with Antoine and Michael on that point.