35 lines
603 B
Plaintext
35 lines
603 B
Plaintext
This rule raises an issue when backticks are used instead of `repr`.
|
|
|
|
== Why is this an issue?
|
|
|
|
In Python 2, backticks are a deprecated alias for ``++repr()++``. The syntax was removed in Python 3. To make the transition to Python 3 easier, they should not be used anymore.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,python]
|
|
----
|
|
return `num` # Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python]
|
|
----
|
|
return repr(num)
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Use "repr" instead.
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|