[Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes? (original) (raw)

Guido van Rossum guido at python.org
Mon Feb 23 16:44:10 CET 2015


I think that's a bit too strong. This has been unquestionably valid, correct Python -- it was an intentional feature from the start. It may not have turned out great, but I think that before warning loudly about every instance of this we should have a silent deprecation (which you can turn into a visible warning with a command-line flag or a warnings filter). And we should have agreement that we're eventually going to make it a syntax error.

On Mon, Feb 23, 2015 at 1:57 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:

See topic "Unrecognized backslash escapes in string literals" in Python list [1]. I agree that this is a problem, especially for novices (but even experience users can make a typo). May be emit SyntaxWarning on unrecognized backslash escapes? An exception is already raised on invalid octal or hexadecimal escapes. '\x' is syntax error, not two characters '\' and 'x'.

[1] http://comments.gmane.org/gmane.comp.python.general/772455


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ guido%40python.org

-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150223/78be2882/attachment.html>



More information about the Python-Dev mailing list