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: py> type( [1, 2, True] ) <class 'list'> py> type( False or 99 ) <class 'int'> Based on your examples, I think you mean any expression *evaluating to* True or False will be a bool. Um, yeah, of course it will. Because it evaluates to one of the only two bool values, True or False. > A = 10<20 > print (type(A)) => <class 'bool'> That's because the value of A is True. > 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. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list