[py-usr] flake8 gives me a W605 but Python don't
Mats Wichmann
mats at wichmann.us
Sat Sep 10 19:54:35 EDT 2022
On 9/10/22 13:20, Stefan Ram wrote:
> <c.buhtz at posteo.jp> writes:
>> 'Version: \d+.\d+.\d+.*'
>
> All unrecognized escape sequences are left in the string
> unchanged, i.e., the backslash is left in the result.
>
> This behavior is useful when debugging: if an escape
> sequence is mistyped, the resulting output is more easily
> recognized as broken.
>
> Some Python versions may emit a DeprecationWarning when
> an unrecognized escape sequence is encountered; future
> Python versions might emit a SyntaxWarning or SyntaxError.
Consider:
$ /usr/bin/python3.11 -X dev stuff.py
/tmp/stuff.py:4: DeprecationWarning: invalid escape sequence '\d'
rex = re.compile('Version: \d+.\d+.\d+.*', re.MULTILINE)
Version: 1.2.3
More information about the Python-list
mailing list