'in' has a lower operator precedence than '=='

('t' in sample) == True

would fix the operator precedence.

On Feb 8, 2008 11:09 AM, c james <[EMAIL PROTECTED]> wrote:

> 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?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to