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


Groups > comp.lang.python > #45269

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

Date 2013-05-13 19:22 -0400
From Dave Angel <davea@davea.name>
Subject Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]
References (2 earlier) <CAA=1kxSJXn1_Y=oy_oxvL+mUtsZvS+FGoy-vZ39OWpbwDF07dQ@mail.gmail.com> <51912C27.3020809@nedbatchelder.com> <mailman.1641.1368470096.3114.python-list@python.org> <VLckt.68242$kO.37986@fx14.fr7> <kmrqsa$uf3$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.1647.1368487365.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 05/13/2013 06:53 PM, Mark Lawrence wrote:
> On 13/05/2013 22:17, Alister wrote:
>> On Mon, 13 May 2013 19:28:29 +0100, Fábio Santos wrote:
>>
>>> I think it is more readable. When doing more complicated statements I
>>> use != instead, but when it's a single test I prefer not … ==
>>>
>>> It's a personal thing. It may also have to do with the fact that I
>>> didn't know python had != when I was a novice.
>>> On 13 May 2013 19:08, "Ned Batchelder" <ned@nedbatchelder.com> wrote:
>>>
>>
>> I would then still write it as not (x == y) to make it clear to myself &
>> avoid any possible confusion although I think that X != Y is much
>> cleaner.
>> 2 lines from the zen stand out here:-
>>
>> Explicit is better than implicit.
>> in the face of ambiguity refuse the temptation to guess.
>>
>> there are many features of Python (& other languages) i did not now when
>> I started but have adopted once I understood what they were & how they
>> worked. then again use what you are most comfortable with.
>>
>> Practicality beats purity
>>
>
> I much prefer the alternative <> for != but some silly people insisted
> that this be removed from Python3.  Just how stupid can you get?
>

So which special methods should the <> operator call?  By rights it 
ought to call both __gt__ and __lt__ and return True if either of them 
is True.


-- 
DaveA

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


Thread

Differences of "!=" operator behavior in python3 and python2 [ bug? ] "Mr. Joe" <titanix88@gmail.com> - 2013-05-13 05:23 +0600
  Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Alister <alister.ware@ntlworld.com> - 2013-05-13 09:59 +0000
    Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Fábio Santos <fabiosantosart@gmail.com> - 2013-05-13 18:26 +0100
    Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Ned Batchelder <ned@nedbatchelder.com> - 2013-05-13 14:08 -0400
    Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Chris Angelico <rosuav@gmail.com> - 2013-05-14 04:15 +1000
    Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Fábio Santos <fabiosantosart@gmail.com> - 2013-05-13 19:28 +0100
      Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Alister <alister.ware@ntlworld.com> - 2013-05-13 21:17 +0000
        Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Fábio Santos <fabiosantosart@gmail.com> - 2013-05-13 22:48 +0100
        Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-13 23:53 +0100
        Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Dave Angel <davea@davea.name> - 2013-05-13 19:22 -0400
          Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-14 05:09 +0000
            Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-05-14 19:01 -0400
              Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-15 00:15 +0000
                Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-05-14 22:20 -0400
        Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Andrew Berg <bahamutzero8825@gmail.com> - 2013-05-13 18:27 -0500
        Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-13 17:32 -0600
        Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-14 05:21 +0000
          Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Alister <alister.ware@ntlworld.com> - 2013-05-15 14:41 +0000
        Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ] Chris Angelico <rosuav@gmail.com> - 2013-05-14 17:31 +1000

csiph-web