On 06/08/2019 23:41:25, Greg Ewing wrote:
Rob Cliffe via Python-Dev wrote:

Sorry, that won't work.  Strings are parsed at compile time, open() is executed at run-time.

It could check for control characters, which are probably the result
of a backslash accident. Maybe even auto-correct them...

By "It", do you mean open() ?  If so:
It already checks for control characters, at least with Python 2.7 on Windows:

>>> open('mydir\test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 22] invalid mode ('r') or filename: 'mydir\test'

As for auto-correct (presumably "\a" to "\\a", "\b" to "\\b" etc.), I hope you're not serious. "In the face of gibberish, refuse the temptation to show how smart your guessing is."
_______________________________________________
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/UK46EASIZVFTIQPORH7AG3EFB522NFI3/

Reply via email to