Re: 3>0 is True

2010-09-15 Thread Yingjie Lan
> From: Jon Siddle > Subject: Re: 3>0 is True > To: python-list@python.org > Date: Wednesday, September 15, 2010, 5:04 PM >   As others have said, it's not > a matter of precendence. Using the > compiler module > you can see how python actually parses this: >

Re: 3>0 is True

2010-09-15 Thread Jon Siddle
As others have said, it's not a matter of precendence. Using the compiler module you can see how python actually parses this: 3 > (0 is True) Compare(Const(3), [('>', Compare(Const(0), [('is', Name('True'))]))]) No great surprise there. 3 > 0 is T

Re: 3>0 is True

2010-09-15 Thread Michael Ricordeau
t for comparisons, including tests, which all have the same precedence and chain from left to right — see section Comparisons" The important words here are : "all have the SAME PRECEDENCE and chain from left to right" See also : http://docs.python.org/reference/exp

Re: 3>0 is True

2010-09-15 Thread Mel
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 littl

Re: 3>0 is True

2010-09-15 Thread Jussi Piitulainen
Yingjie Lan writes: > 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 l

Re: 3>0 is True

2010-09-15 Thread Peter Otten
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

Re: 3>0 is True

2010-09-15 Thread Michael Ricordeau
Because "is" operator take precedence on ">" operator . Le Wed, 15 Sep 2010 05:34:06 -0700 (PDT), Yingjie Lan a écrit : > Hi, > > I am not sure how to interprete this, in the interactive mode: > > >>> 3>0 is True > False > >>>

3>0 is True

2010-09-15 Thread Yingjie Lan
Hi, 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 ligh