[issue27364] Deprecate invalid unicode escape sequences

Emanuel Barry report at bugs.python.org
Thu Jun 23 22:59:45 EDT 2016


Emanuel Barry added the comment:

Yes, it's in use in an awful lot of places (see my patch). The proper fix is to use raw strings, or, if you need actual escapes in the same string, manually escape them. However, as you'll see by looking at the patch, the vast majority of cases are fixed by prepending a single 'r' to the front of the string. In fact, only csv.py and html/parser.py needed more finer-grained escaping.

I think that the argument "It works in non-raw strings" is weak. I've always used raw strings for regular expressions, and this patch would simply move this from being a style issue to being a syntax one (and I think it's fine :).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27364>
_______________________________________


More information about the Python-bugs-list mailing list