On Tue, Feb 9, 2021 at 9:31 PM Paul Moore <p.f.mo...@gmail.com> wrote: > > Personally, I'm not at all keen on the idea of making users always > specify encoding in the first place, even if it's "just for the > transition".
I agree with you. But as I wrote in the PEP, omitted encoding caused much troubles already. Windows users can not just `pip install somepkg` because some library authors write `long_description=open("README.md").read()` in setup.py. I am trying to fix this situation by two parallel approaches: * (This PEP) Provide a tool for finding this type of bugs, and recommend `encoding="utf-8"` for cross-platform library authors. * (Author thread) Make UTF-8 mode more usable for Windows users, especially students. > If we want to switch the default encoding from the locale encoding to > UTF-8, we should find a way to do that which *doesn't* mean that > there's a "transitional" state where using the default is considered > bad practice. That helps no-one, and just adds confusion, which will > last far longer than that one release (there will be people > encountering StackOverflow questions on the topic long after the > default has changed). > > Maybe we just have to accept that we can't work out what people are > intending, and just state in advance in the documentation that the > default will change, then it's documented as an upcoming breaking > change that people can address (if they read the release notes, but we > seem to be assuming they'll spot a warning, so why not assume they > read the release notes, too?). > This PEP doesn't cover how to change the default encoding. So this is slightly off topic. I have two ideas for changing the default encoding: (a) Regular deprecation period: Emitting EncodingWarning by default (3.14 or later), and change the default encoding later (3.17 or later). (b) Enable UTF-8 mode default on Windows. Users can disable UTF-8 mode for backward compatibility. Steve Dower againsted to (b) very strongly. He suggested to emit DeprecationWarning. https://discuss.python.org/t/pep-597-enable-utf-8-mode-by-default-on-windows/3122/16 On the other hand, some core-dev don't like emitting Warning for all omitted `encoding` option. So I don't have strong opinion about which approach is better. I want to see how EncodingWarning and UTF-8 mode are adopted. I want to implement both EncodingWarning and per-site UTF-8 mode setting in Python 3.10. 5+ years later, we will see which approach is adopted by users. * If EncodingWarning is widely adopted by many developers, we can discuss approach (a). * If UTF-8 mode becomes the best practice for Windows users, we can discuss approach (b). Regards, -- Inada Naoki <songofaca...@gmail.com> _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/DY4OPCBKHHRJZMXEJ43MXPNXJ4EUS6MM/ Code of Conduct: http://python.org/psf/codeofconduct/