On Sat, Jan 23, 2021 at 01:31:28PM +0300, Paul Sokolovsky wrote:
* Teachers can teach to use `open_text` to open text files. Students can use "utf-8" by default without knowing about what encoding is.
Let's also add max_int(), min_int(), max_float(), min_float() builtins. Teachers can teach that if you need to min ints, then to use min_int(), if you need to min floats, then to use min_float(), and otherwise, use min(). Bonus point: max_int(), min_int(), max_float(), min_float() are all easier to annotate.
Why would we need to do that? The proposed `open_text()` builtin solves an actual problem with opening files on one platform. Is there an equivalent issue with some platform where min() and max() misbehave by default with ints and floats? If not, then your analogy is invalid. If so, please raise a bug on the tracker. Adding this proposed `open_text` function does not require us to add multiple redundant functions that solve no problems.
So `open_text()` can provide better developer experience, without waiting 10 years.
Except that in 10 years, when the default encoding is finally changed, open_text() is a useless function, which now needs to be deprecated and all the fun process repeated again.
It won't be useless. It will still work as well as it ever did, so useful. It might be redundant, in which case we could deprecate it in documentation and take no further action until Python 5000. -- Steve