Yingjie Lan wrote: > I am not sure how to interprete this, in the interactive mode: > >>>> 3>0 is True > False >>>> (3>0) is True > True >>>> 3> (0 is True) > True > > Why did I get the first 'False'? I'm a little confused. > > Thanks in advance for anybody who shed some light on this.
This looks like comparison chaining. `is` is a comparison operator, like `>`, and chains of comparisons are handled differently. `a < b < c` is equivalent to `(a < b) and (b < c)` Therefore the first expression is testing (3 > 0) and (0 is True) Mel. -- http://mail.python.org/mailman/listinfo/python-list