True == 1 weirdness
harvesting at makes.email.invalid
Sat Sep 19 08:23:55 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
It might be natural when discussing partial orders, where (a < b > c) is
compatible with there not being any max(a, c) or even sup(a, c) at all.
Here's a class of strings ordered by inclusion as substrings. The
comparison (u in w != u) in __lt__ came naturally when I wrote this.
def __init__(self, s):
self.s = s
def __lt__(self, other):
return self.s in other.s != self.s
def __eq__(self, other):
return self.s == other.s
And here's looking for two distinct elements that have a common proper
upper bound in a given set.
data = ('a', 'oo', 'r', 'foo', 'bar')
print(*( (x.s, y.s)
for x in map(S, data)
for y in map(S, data)
for m in map(S, data)
if y != x < m > y != x ),
sep = '\n')
The question is whether some such conditions might, sometimes,
somewhere, in context, look natural. I says yes.
The condition as a whole states a verbalizable relation between x, y, m:
that m is a common upper bound of distinct x, y. It's not stated whether
x < y or x > y or neither.
More information about the Python-list