evaluation of >

Roy Smith roy at panix.com
Sun May 7 22:59:33 EDT 2006


In article <87bqu99qv7.fsf at localhost.localdomain>,
 Gary Wessle <phddas at yahoo.com> wrote:

> Hi
> 
> what does the i > a in this code mean. because the code below is
> giving False for all the iteration. isn't suppose to evaluate each
> value of i to the whole list? thanks
> 
> a = range(8)
> i = 0
> while i < 11:
>     print i > a
>     i = i + 1
> 
> False
> False
> False
> False
> False
> False
> False
> False
> False
> False
> False
> 
> 
> thanks

I'm not sure what you're expecting to happen, or what you're trying to do, 
but comparing an integer to a list is (almost) meaningless.

See http://docs.python.org/ref/comparisons.html, where it says, "objects of 
different types always compare unequal, and are ordered consistently but 
arbitrarily".



More information about the Python-list mailing list