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

Fábio Santos fabiosantosart at gmail.com
Mon May 13 17:48:28 EDT 2013


On Mon, May 13, 2013 at 10:17 PM, Alister <alister.ware at ntlworld.com> 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 at 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.
>

And here I was, thinking I was being pythonic. I hope other people
using my code will be able to understand it well, not just myself, so
using the most common idioms should be the best way to go.


--
Fábio Santos



More information about the Python-list mailing list