[Tutor] comparison bug in python (or do I not get it?)
Steve Willoughby
steve at alchemy.com
Fri Feb 29 17:29:41 CET 2008
Kent Johnson wrote:
> Hans Fangohr wrote:
>
>> In [2]: 2 in [1,2,3] == True
On a slightly different tangent from the other answers you've received
to this question, if you're using a conditional expression, don't
compare it explicitly with True or False, just state the condition:
if 2 in [1,2,3]:
blah
The same holds even if a variable contains True or False:
some_option = True
...
if some_option:
blah
NOT:
if some_option == True:
blah
More information about the Tutor
mailing list