On Tue, Aug 06, 2019 at 08:14:35AM +0200, Michael wrote:
For "filenames" you could, perhaps, make an exception in the calls that use them. e.g., when they are hard-coded in something such as open("..\training\new_memo.doc").
Functions such as open cannot tell whether their argument was provided as a string literal or a variable or other expression. So if you are thinking we change open() to be something like this: if filename contains control characters, and filename is a literal: fix filename that's not going to work. Also, it is important that open() be able to work with filenames which contain control characters, because some files actually do have control characters in them. They are super-hard to deal with in typical POSIX shells, but easy to work with in Python. Unless Python tries to be "helpful" and auto-corrects (auto-corrupts) filenames for us. I don't want the interpreter trying to guess what I meant and running that instead of what I actually wrote. -- Steven