Ben Finney wrote: > Chris Angelico <ros...@gmail.com> writes: > >> That said, though, there's probably a lot of code out there that >> depends on backslashes being non-special, so it's quite probably >> something that can't be changed. But it'd be nice to be able to turn >> on a warning for it. > > If you're motivated to see such warnings, an appropriate place to > implement them would be in PyLint or another established static code > analysis tool.
Pylint already produces a warning. However, it cannot read the author's mind: $ cat tmp.py print("C:\alpha") print("C:\beta") print("C:\gamma") $ pylint tmp.py ************* Module tmp W: 3, 0: Anomalous backslash in string: '\g'. String constant might be missing an r prefix. (anomalous-backslash-in-string) C: 1, 0: Missing module docstring (missing-docstring) The same would go for a warning built into the compiler. Maybe having editors highlight the special combinations would be the more helpful approach. A tooltip could explain the meaning. -- https://mail.python.org/mailman/listinfo/python-list