Hmm... An idea: if a,b==c,d:

sismex01 at hebmex.com sismex01 at hebmex.com
Mon Nov 18 18:02:55 EST 2002


> From: Richard Dillingham [mailto:shadowlord13_1 at yahoo.com]
> Sent: Monday, November 18, 2002 4:59 PM
> 
> > Instead, (a, b) >= (c, d) is defined as (a>c or (a==c and b>=d)).
> 
> I just keep reading that again and again and thinking "WTF? 
> Why? Wha...."
> 
> *shudders*
> 
> Now I'm sorry I asked...
>

Because it's the correct thing to do, when comparing
tuples.  In the comparison, the tuple isn't a container
to make shorthand versions of larger comparisons, rather,
it's a quantity in itself.

It's like comparing strings: first the first char,
then the second, etc.

In the case of comparing two tuples, first it compares
the first elements, if they're equal, then the seconds,
thirds, etc.

So, the above equivalence is what it really does, even
if it does look "ugly". :-)

-gus




More information about the Python-list mailing list