[issue32912] Raise non-silent warning for invalid escape sequences

Raymond Hettinger report at bugs.python.org
Tue Jul 23 16:40:18 EDT 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> Raymond, are you in agreement that these warnings should 
> at some point eventually become syntax errors?

I used to think so, but after experiencing the incessant warnings, I question the value.  In inactive sessions (either with the regular REPL or the ipython REPL), they are a recurring annoyance that interferes with data exploration live demos.  Perhaps, this should be left for a lint or code analysis tool.  Why should we intentionally break code that is currently working fine.

Another issue that I've encountered is that ASCII art becomes gets flagged.  Switching to a raw string then kills the unicode escape sequences.

This isn't really a "Raymond doesn't like this" concern.  I think anyone who starts using 3.8 on a daily basis for non-toy examples will constantly run into this.  Possibly, it catches a real error, but most often it will just be a recurring distractor, especially when teaching Python.  All instructors and runners of live demos will need to memorize exactly which characters require an escape and which don't -- it creates a new burden that didn't exist before.  And if the source of the problem is in an external library, the result is unactionable by the user, merely making their experience unpleasant.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32912>
_______________________________________


More information about the Python-bugs-list mailing list