We should revisit what we want to do (if anything) about invalid escape 
sequences.

For Python 3.8, the DeprecationWarning was converted to a SyntaxWarning which 
is visible by default.  The intention is to make it a SyntaxError in Python 3.9.

This once seemed like a reasonable and innocuous idea to me; however, I've been 
using the 3.8 beta heavily for a month and no longer think it is a good idea.  
The warning crops up frequently, often due to third-party packages (such as 
docutils and bottle) that users can't easily do anything about.  And during 
live demos and student workshops, it is especially distracting.  

I now think our cure is worse than the disease.  If code currently has a 
non-raw string with '\latex', do we really need Python to yelp about it (for 
3.8) or reject it entirely (for 3.9)?   If someone can't remember exactly which 
special characters need to be escaped, do we really need to stop them in their 
tracks during a data analysis session?  Do we really need to reject ASCII art 
in docstrings: ` \-------> special case'?  

IIRC, the original problem to be solved was false positives rather than false 
negatives:  filename = '..\training\new_memo.doc'.  The warnings and errors 
don't do (and likely can't do) anything about this.

If Python 3.8 goes out as-is, we may be punching our users in the nose and 
getting almost no gain from it.  ISTM this is a job best left for linters.  For 
a very long time, Python has been accepting the likes of 'more \latex markup' 
and has been silently converting it to 'more \\latex markup'.  I now think it 
should remain that way.  This issue in the 3.8 beta releases has been an almost 
daily annoyance for me and my customers. Depending on how you use Python, this 
may not affect you or it may arise multiple times per day.


Raymond

P.S.  Before responding, it would be a useful exercise to think for a moment 
about whether you remember exactly which characters must be escaped or whether 
you habitually put in an extra backslash when you aren't sure.  Then see:  
https://bugs.python.org/issue32912
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/ZX2JLOZDOXWVBQLKE4UCVTU5JABPQSLB/

Reply via email to