NShiftKey-Rule-Guide logo NShiftKey-Rule-Guide

"<>" should not be used to test inequality

python:InequalityUsage

The forms <> and != are equivalent. But in Python 2.7.3 the <> form is considered obsolete.

Noncompliant Code Example

return a <> b # Noncompliant

Compliant Solution

return a != b