Why prefer != over <> for Python 3.0?
Sat Mar 29 12:59:00 CET 2008
Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> reserve <> for "greater than or less than but not equal to" which is
> subtly different. (Think about unordered values, where x != y does not
> imply that x < y or x > y, e.g. IEEE NaNs.)
Heh, good point.
> > The scary choice is /= which can be interpreted as an assignment.
> "Can be"?
Yes, what I mean is that some languages (e.g. Ada, Haskell) use /= for
nonequality. So if you switch between Haskell and C, you could find
yourself typing /= when you mean != and the compiler won't flag it.
More information about the Python-list