On Sat, Jan 23, 2021 at 7:31 PM Paul Sokolovsky email@example.com wrote:
- Replacing open with open_text is easier than adding `,
How is it easier, if "open_text" exists only in imagination, while encoding="utf-8" has been there all this time?
Note that the warning is not enabled by default anytime soon. If we decide to change the default encoding and enable the EncodingWarning by default in Python 3.15, user can use `open_text()` for 3.10~3.15. It will be enough backward compatibility for most users.
- 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.
It is off-topic. Please don't compare apple and orange.
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.
Yes, if we can change the default encoding in 2030, two open functions will become messy. But there is no promise for the change. Without mitigating the pain, we can not change the default encoding forever.
Anyway, thank you for your feedback. Two people prefer `encoding="utf-8"` to `open_text()`.
I still wait for feedbacks from more people before updating the PEP 597.