Ezio Melotti added the comment:
'a' evaluates to true, but it's not equal to True:
>>> bool('a')
True
>>> 'a' == True
False
but 1 and True are equal (for historical reasons):
>>> 1 == True
True
Similarly '' evaluates to false, but it's not equal to False:
>>> bool('')
False
>>> '' == False
False
whereas 0 is equal to False:
>>> 0 == False
True
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21993>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com