In article <[EMAIL PROTECTED]>,
c james  <[EMAIL PROTECTED]> wrote:
>>>> sample = {'t':True, 'f':False}
>>>> 't' in sample == True
>False
>
>Why is this?

http://docs.python.org/lib/comparisons.html

"Comparisons can be chained arbitrarily; for example, x < y <= z is
equivalent to x < y and y <= z, except that y is evaluated only once
[ ... ]
Two more operations with the same syntactic priority, "in" and "not
in", are supported only by sequence types"

So:
't' in sample == True
is equivalent to:
't' in sample and sample == True
and obviously:
>>> sample == True
False

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to