[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd truth result with in and ==

"John Pote"  wrote in message 
news:e0a8e1bc-6e03-e42b-d6e8-d690e2d5a10f at jptechnical.co.uk...
> I interpret the above comparison as
>  >>> bool([1,2,3]) == bool(True)
> True
>  >>>

A tiny addition to what has already been said.

As True is by definition a boolean, you can write this as

>>> bool([1, 2, 3]) == True

I have on vary rare occasions had to convert 'truthiness' to an actual 
boolean, and this is how I do it.

Frank Millman