Is there a difference between != and <> operators in Python?

Question:

I tried searching, but could not find much about the <> operator.

Python – Basic Operators mentions that <> is "similar" to the != operator and does not say what is different or how it is different.

My tests seem to show it is the same:

a = 2, b = 3
>>> a != b
True
>>> a <> b
True
>>> b = 2
>>> a != b
False
>>> a <> b
False
Asked By: Pa1

||

Answers:

The Python documentation says that they are equivalent.

The comparison operators <> and != are alternate spellings of the same operator. != is the preferred spelling; <> is obsolescent.

The <> operator has been removed from Python 3.

Answered By: clemens
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.