Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96844

Re: True == 1 weirdness

From Jussi Piitulainen <harvesting@makes.email.invalid>
Newsgroups comp.lang.python
Subject Re: True == 1 weirdness
Date 2015-09-19 09:23 +0300
Organization A noiseless patient Spider
Message-ID <lf5fv2bnczo.fsf@ling.helsinki.fi> (permalink)
References <mailman.30.1442580482.16376.python-list@python.org> <55fc0e4d$0$1645$c3e8da3$5496439d@news.astraweb.com> <1442583652.2433512.387297097.0C910B45@webmail.messagingengine.com> <mthktk$q5p$1@ger.gmane.org> <mailman.2.1442603566.21674.python-list@python.org>

Show all headers | View raw


Random832 writes:

> 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.

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.

class S(object):
    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
    def __str__(self):
        return 'S({})'.format(repr(self.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')

Output:
('a', 'r')
('r', 'a')

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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: True == 1 weirdness Random832 <random832@fastmail.com> - 2015-09-18 08:47 -0400
  Re: True == 1 weirdness Steven D'Aprano <steve@pearwood.info> - 2015-09-18 23:14 +1000
    Re: True == 1 weirdness Random832 <random832@fastmail.com> - 2015-09-18 09:40 -0400
      Re: True == 1 weirdness Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-09-19 19:19 +1200
    Re: True == 1 weirdness Terry Reedy <tjreedy@udel.edu> - 2015-09-18 14:24 -0400
    Re: True == 1 weirdness Random832 <random832@fastmail.com> - 2015-09-18 15:12 -0400
      Re: True == 1 weirdness Jussi Piitulainen <harvesting@makes.email.invalid> - 2015-09-19 09:23 +0300
    Re: True == 1 weirdness Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-18 15:13 -0600
    Re: True == 1 weirdness Random832 <random832@fastmail.com> - 2015-09-18 17:21 -0400

csiph-web