3>0 is True
Yingjie Lan
lanyjie at yahoo.com
Wed Sep 15 09:33:57 EDT 2010
> From: Jon Siddle <js at corefiling.co.uk>
> Subject: Re: 3>0 is True
> To: python-list at 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:
>
> 3 > (0 is True)
> Compare(Const(3), [('>', Compare(Const(0), [('is',
> Name('True'))]))])
>
> No great surprise there.
>
> 3 > 0 is True
> Compare(Const(3), [('>', Const(0)), ('is',
> Name('True'))])
>
> As you can see, it's not the same. Two comparisons are
> being done "at
> once", not
> one comparison on the result of another.
>
> Hope this helps
Thank you all for nailing down this itching issue for me!
All I can say is: Wow!
You all have a teribly nice day!
Yingjie
More information about the Python-list
mailing list