keyword 'in' not returning a bool?

c james cjames at callone.net
Fri Feb 8 18:09:46 CET 2008


Try this

>>> sample = {'t':True, 'f':False}
>>> 't' in sample
True
>>> type('t' in sample)
<type 'bool'>
>>> 't' in sample == True
False

Why is this?  Now try
>>> bool('t' in sample) == True
True

Can someone explain what is going on?




More information about the Python-list mailing list