45 lines
897 B
Plaintext
45 lines
897 B
Plaintext
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
|
|
|
|
[source,python,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
return a <> b # Noncompliant: the operator "<>" is deprecated.
|
|
----
|
|
|
|
|
|
==== Compliant solution
|
|
|
|
[source,python,diff-id=1,diff-type=compliant]
|
|
----
|
|
return a != b
|
|
----
|
|
|
|
== Resources
|
|
|
|
=== Documentation
|
|
|
|
* Python Documentation: https://docs.python.org/2.7/reference/lexical_analysis.html#operators[Python 2.7 - Operators]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Use "!=" instead.
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|