On Fri, Feb 5, 2021 at 10:46 AM Ben Rudiak-Gould firstname.lastname@example.org wrote:
On Thu, Feb 4, 2021 at 3:29 PM Chris Angelico email@example.com wrote:
With "t", it takes/gives Unicode objects, but with "b" it uses bytes.
Sure, in Python 3, but not in Python 2, or C.
Python 2 isn't changing any more now, and we're not proposing changes to C. We're looking at Python 3 here.
Anyway, moral correctness is beside the point. People in point of fact don't write encoding='utf-8' when they should, because it's so much to type. If you had to write binary=True to enable binary mode, fewer people would have bothered to use it in the Python 2 era, and there would have been more portability (and Python 3 transition) problems. There shouldn't have been, but there would have been. Everything about the mode parameter is a sop to convenience. Really you should write open(mode=io.APPEND) or something.
There WERE problems that resulted from people not specifying "b" or "t" when they needed to. I don't think spelling it binary=True would have made any difference.
But it sounds like you're arguing for the complete abolition of the character-flag mode parameter, which I can't strongly dispute, other than that it'd be a massive backward compatibility break. The same line of argument says that we shouldn't be expanding it, especially not with something that can be better spelled in another way (the encoding parameter) and is far more restrictive (only two possible values for that parameter).