Obsolesence of <> (fwd)
Lulu of the Lotus-Eaters
mertz at gnosis.cx
Thu May 31 18:11:58 CEST 2001
D> The Pascal-ish inequality operator ('<>') has effectively been
D> deprecated in favor of the Algol-ish (C-ish) inequality
D> operator ('!=').
D> I don't believe it will be removed from the compiler any time
D> soon, but nobody uses it anyways.
barry at digicool.com (Barry A. Warsaw) wrote:
|Not necessarily true. I use it and strongly prefer it. I know that
|Guido dislikes <> enough to actually change it to != in the standard
|library. I personally hope that <> will never go away.
I feel the same as Barry on this. The '<>' inequality operator just
"feels" right to me.
It is very easy to read it as "is less than or greater than" on the
analogy of ">=" reading "is greater than or equal to." Since all Python
values can be compared, every two unequal things are indeed less than or
greater than one another. Two equal things, naturally, are neither less
than nor greater than one another. So you could imagine the operators
x <> y ==> x < y or x > y
x <= y ==> x < y or x == y
(Of course, admittedly, I have more of a background in Pascal and xBase
than in C).
On the other hand, the "!=" operator looks an awful lot like the
augmented assignment operators: "+=", "-=", "*=" and so on. If one
reads by this analogy, one imagines the "!=" doing something like
"negate the value at left with the value at right."
x += y ==> x = x+y
x != y ==> x = x!y
Obviously, that reading doesn't really mean anything, but it sort of
resembles what one might do with a bitwise boolean operator.
But one can always learn irregular spellings. I hear people have even
learned Perl (and English).
More information about the Python-list