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

Chris Angelico rosuav at gmail.com
Mon May 13 14:15:22 EDT 2013


On Tue, May 14, 2013 at 4:08 AM, Ned Batchelder <ned at nedbatchelder.com> wrote:
>
> On 5/13/2013 1:26 PM, Fábio Santos wrote:
>
>
> On 13 May 2013 11:04, "Alister" <alister.ware at ntlworld.com> 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 !=.
>
>
>
> If you don't mind my asking, why do you do that?

I think it's fairly obvious. Like the stumpy-tailed dog from "The
Loaded Dog" [1], he's saving up the != operator in case he needs it
later.

ChrisA

[1] Full text here. http://jendi.bowmeow.com.au/loadeddog1.html



More information about the Python-list mailing list