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

2013-05-15 Thread Alister
> != is explicit. > > There is no ambiguity that needs to be guessed. Which is why i said it thought X != Y is cleaner i guess i wasn't totally clear, I would write X != Y its because the OP preferred to use the other format I recommended that he made the operator ordering explicit. -- Na

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

2013-05-14 Thread Steven D'Aprano
On Tue, 14 May 2013 19:01:38 -0400, Dennis Lee Bieber wrote: > On 14 May 2013 05:09:48 GMT, Steven D'Aprano > declaimed the following in > gmane.comp.python.general: >> The <> operator comes from Pascal, where it was used as "not equal" >> since > > I thought it came from BASIC... > http:

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

2013-05-14 Thread Chris Angelico
On Tue, May 14, 2013 at 9:22 AM, Dave Angel wrote: > On 05/13/2013 06:53 PM, Mark Lawrence wrote: >> 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 cal

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

2013-05-13 Thread Steven D'Aprano
On Mon, 13 May 2013 21:17:41 +, Alister 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. I think that is sad. If I read "not (x == y)" I would assume that the person writing the co

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

2013-05-13 Thread Steven D'Aprano
On Mon, 13 May 2013 19:22:24 -0400, Dave Angel wrote: > 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. The <> operator comes from Pascal, where it was used as "not equal" since ASCII doesn't

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

2013-05-13 Thread Cameron Simpson
On 13May2013 21:41, Dave Angel wrote: | On 05/13/2013 07:30 PM, Cameron Simpson wrote: | >On 13May2013 19:22, Dave Angel wrote: | >| On 05/13/2013 06:53 PM, Mark Lawrence wrote: | >| >I much prefer the alternative <> for != but some silly people insisted | >| >that this be removed from Python3.

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

2013-05-13 Thread Dave Angel
On 05/13/2013 07:30 PM, Cameron Simpson wrote: On 13May2013 19:22, Dave Angel wrote: | On 05/13/2013 06:53 PM, Mark Lawrence wrote: | >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 m

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

2013-05-13 Thread Ian Kelly
On Mon, May 13, 2013 at 5:27 PM, Andrew Berg wrote: > On 2013.05.13 17:53, Mark Lawrence wrote: >> I much prefer the alternative <> for != but some silly people insisted >> that this be removed from Python3. > It's not removed from Python 3, though: > > Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 20

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

2013-05-13 Thread Cameron Simpson
On 13May2013 19:22, Dave Angel wrote: | On 05/13/2013 06:53 PM, Mark Lawrence wrote: | >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 i

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

2013-05-13 Thread Andrew Berg
On 2013.05.13 17:53, Mark Lawrence wrote: > I much prefer the alternative <> for != but some silly people insisted > that this be removed from Python3. It's not removed from Python 3, though: Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 2013, 20:30:21) [MSC v.1600 64 bit (AMD64)] on win32 Type "hel

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

2013-05-13 Thread Dave Angel
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. I

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

2013-05-13 Thread Mark Lawrence
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 did

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

2013-05-13 Thread Fábio Santos
On Mon, May 13, 2013 at 10:17 PM, 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

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

2013-05-13 Thread Alister
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

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

2013-05-13 Thread Fábio Santos
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" wrote: > >

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

2013-05-13 Thread Chris Angelico
On Tue, May 14, 2013 at 4:08 AM, Ned Batchelder wrote: > > On 5/13/2013 1:26 PM, Fábio Santos wrote: > > > On 13 May 2013 11:04, "Alister" wrote: >> this looks to me like an issue with operator precidence >> >> you code is evaluating as (Not x) == y >> rather than not (x == y) > > I can say for s

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

2013-05-13 Thread Ned Batchelder
On 5/13/2013 1:26 PM, Fábio Santos wrote: On 13 May 2013 11:04, "Alister" > wrote: > this looks to me like an issue with operator precidence > > you code is evaluating as (Not x) == y > rather than not (x == y) I can say for sure that the precedence is as ex

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

2013-05-13 Thread Fábio Santos
On 13 May 2013 11:04, "Alister" wrote: > this looks to me like an issue with operator precidence > > you code is evaluating as (Not x) == y > rather than not (x == y) I can say for sure that the precedence is as expected. I always use "not ... == ..." Instead of !=. -- http://mail.python.org/mai

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

2013-05-13 Thread Alister
On Mon, 13 May 2013 05:23:16 +0600, Mr. Joe wrote: > I seem to stumble upon a situation where "!=" operator misbehaves in > python2.x. Not sure if it's my misunderstanding or a bug in python > implementation. Here's a demo code to reproduce the behavior - > """ > # -*- coding: utf-8 -*- > from __f

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

2013-05-12 Thread Rotwang
On 13/05/2013 00:40, Ian Kelly wrote: On Sun, May 12, 2013 at 5:23 PM, Mr. Joe wrote: I seem to stumble upon a situation where "!=" operator misbehaves in python2.x. Not sure if it's my misunderstanding or a bug in python implementation. Here's a demo code to reproduce the behavior - The != o

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

2013-05-12 Thread Ian Kelly
On Sun, May 12, 2013 at 5:23 PM, Mr. Joe wrote: > I seem to stumble upon a situation where "!=" operator misbehaves in > python2.x. Not sure if it's my misunderstanding or a bug in python > implementation. Here's a demo code to reproduce the behavior - The != operator is implemented by the __ne__

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

2013-05-12 Thread Christian Heimes
Am 13.05.2013 01:23, schrieb Mr. Joe: > I seem to stumble upon a situation where "!=" operator misbehaves in > python2.x. Not sure if it's my misunderstanding or a bug in python > implementation. Here's a demo code to reproduce the behavior - > """ Python 2.7 doesn't use the negation of __eq__ whe

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

2013-05-12 Thread Ned Batchelder
On 5/12/2013 7:23 PM, Mr. Joe wrote: I seem to stumble upon a situation where "!=" operator misbehaves in python2.x. Not sure if it's my misunderstanding or a bug in python implementation. Here's a demo code to reproduce the behavior - """ # -*- coding: utf-8 -*- from __future__ import unicode_li

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

2013-05-12 Thread Mr. Joe
I seem to stumble upon a situation where "!=" operator misbehaves in python2.x. Not sure if it's my misunderstanding or a bug in python implementation. Here's a demo code to reproduce the behavior - """ # -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function class DemoClass