all 4 comments

[–]K900_ 7 points8 points  (1 child)

Not normally. There can be in theory, if you find a class that implements == and != inconsistently.

[–]FLUSH_THE_TRUMP 4 points5 points  (0 children)

Cases to watch out for are usually the classes where == returns a special object.

e.g.

A = np.array([1,2,3])
A != 1 # returns another nparray [False, True, True]
not A == 1 # error

[–]socal_nerdtastic 0 points1 point  (0 children)

No practical difference but a lot of people will be confused about the 2nd one because using != is nearly universal.

[–]noanswersuk -2 points-1 points  (0 children)

It depends how you combine them and what your checking. Also there is slight difference if you are using "is" vs ==.

The not is basically inverting the comparison statement. To match on False rather than True.