[Baypiggies] What is happening here with true/false comparisons

Max Slimmer max at theslimmers.net
Mon Jan 25 22:12:33 CET 2010


Can anyone explain the following:

>>> a = 1
>>> b = 2
>>> alist = [5,6]
>>> print a in alist
False

>>> a in alist == b in alist
False
>>> a in alist == a in alist
False
>>> bool(a in alist) == bool(b in alist)      # this does what we expect
True
>>> c = 5
>>> c in alist == c in alist
False
>>>

max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20100125/7469a504/attachment.htm>


More information about the Baypiggies mailing list