[Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

Serhiy Storchaka storchaka at gmail.com
Tue Feb 24 10:21:41 CET 2015


On 24.02.15 11:09, Nick Coghlan wrote:
> Oh, I like that idea, especially the variant that includes a search
> friendly phrase like "embedded escapes" in the error message. And
> unlike changing the handling of string literals generally, the impact
> would be isolated to a few exception __repr__ implementations.

It can require changing code in tens of places like 
``PyErr_Format(FooError, "File %R is not valid FOO", filename)`` or 
``raise FooError("File %r is not valid FOO" % (filename,))``.

And of course 'c:\test.txt' is valid name on Unix.




More information about the Python-Dev mailing list