On Fri, Feb 5, 2021 at 10:17 AM Ben Rudiak-Gould firstname.lastname@example.org wrote:
'L' could be argued to be unnecessary if there's a simple way to achieve the same thing with the encoding parameter (which currently there isn't).
I'd rather work that one out the opposite way, having encoding="locale" (or encoding="system" or something), and then that distinction won't apply. Whether that's PEP 597 or something else, an encoding parameter is the logical way to do this.
The mode parameters have significant impact on the overall behaviour of the resulting file object. If you specify "r", you get something that you can read from; specify "w" and you get something you can write to. With "t", it takes/gives Unicode objects, but with "b" it uses bytes. The encoding parameter controls how it transforms what's on disk into the Unicode strings it returns, but regardless of that value, it will always be returning strings (or accepting strings, when writing). The choice of encoding is, by comparison, a much less significant difference.
(Yes, there's the "U" flag for universal newlines, but that's deprecated.)