On Mar 24, 12:19 am, Dustan <[EMAIL PROTECTED]> wrote: > On Mar 21, 3:57 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] writes: > > > if 'one' and 'two' in f: > > > alist.append(f) > > > Use: > > if 'one' in f and 'two' in f: ... > > Personally, I would put parentheses around to be clearer: > > if ('one' in f) and ('two' in f): ... > > I'm not saying to put parentheses around everything, but in the more > ambiguous cases, it certainly helps.
Please help me understand why this is a "more ambiguous" case. To me, alternative interpretations have extremely low scores for utility and likelihood: (1) 'and' has higher precedence than 'in': 'one' in (f and 'two') in f # chained (x in y in z) (2) 'and' has same precedence as 'in': (('one' in f) and 'two') in f Cheers, John -- http://mail.python.org/mailman/listinfo/python-list