New submission from Reynir Reynisson:

Strings like "\u" trigger a SyntaxError. According to the language reference 
"all unrecognized escape sequences are left in the string unchanged"[0]. The 
string "\u" clearly doesn't match any of the escape sequences (in particular 
\uxxxx).

This may be intentional, but it is not clear from the language reference that 
this is the case. If it is intentional it should probably be stated more 
explicit in the language reference.

I think this may be confusing for new users since the syntax errors may lead 
them to believe the interpreter will give syntax error for all unrecognized 
escape sequences.

[0]: http://docs.python.org/3/reference/lexical_analysis.html#literals

----------
assignee: docs@python
components: Documentation, Unicode
messages: 187173
nosy: docs@python, ezio.melotti, reynir
priority: normal
severity: normal
status: open
title: Unrecognized string literal escape sequences give SyntaxErrors
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17777>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to