What is the difference between these two lines of code:
if not x == \'val\':
and
if x != \'val\':
Is one
I want to expand on my readability comment above.
Again, I completely agree with readability overriding other (performance-insignificant) concerns.
What I would like to point out is the brain interprets "positive" faster than it does "negative". E.g., "stop" vs. "do not go" (a rather lousy example due to the difference in number of words).
So given a choice:
if a == b
(do this)
else
(do that)
is preferable to the functionally-equivalent:
if a != b
(do that)
else
(do this)
Less readability/understandability leads to more bugs. Perhaps not in initial coding, but the (not as smart as you!) maintenance changes...