[issue28128] Improve the warning message for invalid escape sequences

Emanuel Barry report at bugs.python.org
Thu Sep 15 22:01:07 EDT 2016


Emanuel Barry added the comment:

Thank you Nick for the useful feedback! I think that a subclass of DeprecationWarning and SyntaxWarning would be a good idea; I'll play around with that.

As far as when the warning should occur, I agree that erroring out at the compile step isn't optimal, however (AFAIK) strings aren't checked again once they've been created; they're assumed to be correct (and checking them at runtime would presumably add a performance hit to *all* strings, which I think is too big a price to pay).

On the other hand, a way to ignore invalid escapes in certain files could be considered, but we need to be somewhat careful since some people might choose to silence all warnings, thus defeating the purpose.

----------

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


More information about the Python-bugs-list mailing list