org.sonar.l10n.py.rules.python.InequalityUsage.html Maven / Gradle / Ivy
This rule raises an issue when the inequality operator <>
is used.
Why is this an issue?
The operators <>
and !=
are equivalent. However, the <>
operator is considered obsolete in
Python 2.7 and has been removed from Python 3. Therefore, it is recommended to use !=
instead.
Code examples
Noncompliant code example
return a <> b # Noncompliant: the operator "<>" is deprecated.
Compliant solution
return a != b
Resources
Documentation
- Python Documentation: Python 2.7 - Operators
© 2015 - 2024 Weber Informatics LLC | Privacy Policy