Is this valid ?

Gary Herron gherron at islandtraining.com
Wed Mar 19 22:30:11 CET 2008


Stef Mientki wrote:
> hello,
>
> by accident I typed a double value test,
> and to my surprise it seems to work.
> Is this valid ?
>
> a = 2
> b = 2
>
> a == b == 2
>
> thanks,
> Stef Mientki
>
>   
Yes.  It's been in Python since the earliest days.  You usually see it 
in test like this:
  if a < b < c:
but any comparison operators work.  The meaning is the same as the AND 
of each individual test.

Gary Herron




More information about the Python-list mailing list