38 lines
1.3 KiB
Plaintext
38 lines
1.3 KiB
Plaintext
![]() |
=== On 2014-11-04T15:59:00Z Ann Campbell Wrote:
|
|||
|
pylint:W1401
|
|||
|
|
|||
|
=== On 2020-04-17T15:18:27Z Nicolas Harraudeau Wrote:
|
|||
|
Deprecating this rule.
|
|||
|
|
|||
|
It raises many issues and most of them look like False Positives. The most common false positives are strings containing regular expressions. Example:
|
|||
|
|
|||
|
----
|
|||
|
import re
|
|||
|
re.sub('\(', '[', '(test)') # False Positive
|
|||
|
----
|
|||
|
This rule raises 380+ issues just on Pypy.
|
|||
|
|
|||
|
|
|||
|
We could try to reduce the number of false positives by focusing only on strings passed to functions which do not use backslashes, such as ``++print++`` or ``++Exception++``, but the value seems to be low. The worst that could happen is that the backslash is displayed as part of the string or that a few characters are misinterpreted:
|
|||
|
|
|||
|
|
|||
|
----
|
|||
|
In [36]: raise Exception("\.")
|
|||
|
---------------------------------------------------------------------------
|
|||
|
Exception Traceback (most recent call last)
|
|||
|
<ipython-input-36-de3222772775> in <module>
|
|||
|
----> 1 raise Exception("\.")
|
|||
|
|
|||
|
Exception: \.
|
|||
|
|
|||
|
|
|||
|
In [41]: raise Exception("\234324")
|
|||
|
---------------------------------------------------------------------------
|
|||
|
Exception Traceback (most recent call last)
|
|||
|
<ipython-input-41-d0bd825b64dd> in <module>
|
|||
|
----> 1 raise Exception("\234324")
|
|||
|
|
|||
|
Exception: 324
|
|||
|
----
|
|||
|
|