make (a < b < c) illegal?

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Wed Feb 7 20:57:35 PST 2007


Kirk McDonald wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Obligatory comment: it would return true also if it were interpreted 
>> as (a < b) == (c < d) or as ((a < b) == c) < d. So the example is 
>> unclear.
>>
>> :o)
>>
>>
>> Andrei
> 
> For ultimate clarity, I refer you to the Python language reference on 
> the topic:
> 
> http://docs.python.org/ref/comparisons.html
> 
> It's probably better to point you there than for me to attempt to 
> explain it poorly. :-)

Oh, I did run the interpreter (gotta love Linux - all the cool stuff is 
one command away) and figured how chained comparisons work. Thanks a lot 
for the reference.

BTW, Perl 6 is slated to implement chain comparisons as well:

http://en.wikipedia.org/wiki/Perl_6#Chained_comparisons


Andrei



More information about the Digitalmars-d mailing list