True == 1 weirdness
random832 at fastmail.com
Fri Sep 18 21:12:38 CEST 2015
On Fri, Sep 18, 2015, at 14:24, Terry Reedy wrote:
> If a, b, c are members of a totally ordered set, so that < is
> transitive, this is equivalent to max(a,c) < b. But the latter makes an
> irrelevant comparison between a and c.
But *who would write that?* It's not a natural form of notation. I'm not
saying it doesn't mean anything in Python. Obviously everything that is
allowed means something. I'm saying no-one would write that in an
ordinary context of human communication and expect to be understood.
> > Your claim seemed to be that these combinations *are*
> > used, since you claimed that python implements the *same* semantics.
> The semantics Python copies from math is "a op b op c == a op b and b op
I don't believe those *are* the semantics in math. I believe that in
math this notation is *specifically* meant to support "all of these
things are related to all of the others in ways that can be summarized
in a single expression" and that mixing operations in a way that does
not allow that is a misuse of the notation. In other words, any "a op b
op c" that does not allow you to make a statement on how a is related to
c is a *mistake*, because it means that you're welding together two
things that aren't logically connected to each other at all.
If there is no operator op3 where a op1 b op2 c implies a op3 c, then
you should not put a and c in the same inequality, full stop.
> where 'op' is a binary predicate or comparison operator. I also
> happen to believe you are wrong in the specific examples. But the
> semantic copying would apply even if a particular combination had not
> yet ever been used.
More information about the Python-list