Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In [268]: 'c' in a == True > Out[268]: False > > In [269]: ('c' in a) == True > Out[269]: True > > In [270]: 'c' in (a == True) > ----------------------------------------------------------------------- > ---- ><type 'exceptions.TypeError'> Traceback (most recent call >last) > > /home/bj/<ipython console> in <module>() > ><type 'exceptions.TypeError'>: argument of type 'bool' is not iterable > > > What's going on there?
See http://docs.python.org/ref/comparisons.html > Comparisons can be chained arbitrarily, e.g., x < y <= z is equivalent > to x < y and y <= z, except that y is evaluated only once (but in both > cases z is not evaluated at all when x < y is found to be false). In exactly the same way: 'c' in a == True is equivalent to: 'c' in a and a == True which is False. -- http://mail.python.org/mailman/listinfo/python-list