pylint #104571 warn about backslash escape [validation pending]
Martin Pool on python-projects: We were recently debugging some code like this: re.compile('\\/') This is legal Python (equivalent to r'\/') but possibly buggy. It would be safer and clearer to say r'\/' if that's what you want - and the 're' manual highly recommends you should use raw strings here. In Python (unlike C, Perl, Python REs and most unix tools) backslashes followed by a non-special character in a string literal are passed through as backslashes, which in my small survey surprised many people. | |
priority | normal |
---|---|
type | enhancement |
done in | 0.26.0 |
load left | 0.000 |
closed by | #b40e3b4bc006 [format checker] check for anomalous backslash escape (new W1401, W1402). Closes #104571 |