On 22/09/2016 02:40, Steve D'Aprano wrote:
On Wed, 21 Sep 2016 10:25 pm, BartC wrote:
On 21/09/2016 05:03, Cai Gengyang wrote:
Are there any other data types that will give you type(A) or type(B) =
<class 'bool'> besides True and False?
No types but any variable or expression containing True or False will be
a bool type (or class bool):
"Containing" True or False? Certainly not:
Well, I wrote 'containing' before I added 'or expression', when
'evaluating to' might have been better.
print (10<20) => True
print (type(10<20)) => <class 'bool'>
10<20 shouldn't be thought of as some alternative value which is a bool, any
more than we should think of 1+1 as being a different value to 2.
They're a little different:
1+1 yielding 2 is int+int => int
10<20 yielding True is int<int => bool
My post was really about bool values lurking everywhere not just where
you explicitly write or assign True or False.