On Sat, Jul 12, 2008 at 8:10 PM, Dick Moores <[EMAIL PROTECTED]> wrote:

> But why will a tuple with two elements will always evaluate to
> True?
>
> In [2]: (3,5) == True
> Out[2]: False
> In [3]: ("qwerty", "asdfg") == True
> Out[3]: False
> In [4]:
>
>
The value formally known as True is only one member of the set of things
that don't evaluate to False...  Confused yet?

Anyway, this might make it a bit clearer:

>>> (3,2) == True
False
>>> if (3,2): print "Tru, dat"
...
Tru, dat
>>>

In other words, "(3,2)" isn't exactly the same as "True" - but it doesn't
evaluate to False, either, so it's true.

It's a bit like arguments about the nature of Good and Evil, I'd say.
-- 
www.fsrtechnologies.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to