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

I tried to search, but could not find much about <> .

https://www.tutorialspoint.com/python/python_basic_operators.htm mentions that <> "similar" to the != operator and does not say that it is different or how it differs.

My tests seem to show the same thing:

 a = 2, b = 3 >>> a != b True >>> a <> b True >>> b = 2 >>> a != b False >>> a <> b False 

Any help to figure this out would be appreciated.

+7
source share
1 answer

The python documentation says they are equivalent.

The comparison operators <> and != Are alternative spellings of the same operator. != - preferred spelling; <> becoming obsolete.

The <> operator has been removed from Python 3.

+8
source

All Articles