We know from release notes, that "A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning". Sometimes it's true:
$ python -W error
Python 3.6.0b1+ (default, Oct 4 2016, 08:47:51)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> "xxx" != "hello \world"
DeprecationWarning: invalid escape sequence '\w'
But shouldn't DeprecationWarning be in the following case as well?
$ cat a.py
def f(s):
return s != "hello \world"
$ cat b.py
import a
print(a.f("xxx"))
$ python b.py
True
$ python -W error b.py
True |