My previous thread is hijacked about "auto guessing" idea, so I split this thread for pathlib.
Path.open() was added in Python 3.4. Path.read_text() and Path.write_text() was added in Python 3.5. Their history is shorter than built-in open(). Changing its default encoding should be easier than built-in open and TextIOWrapper. New default encodings are: * read_text() default encoding is "utf-8-sig" * write_text() default encoding is "utf-8" * open() default encoding is "utf-8-sig" when mode is "r" or None, "utf-8" otherwise. Of course, we need a regular deprecation period. When encoding is omitted, they emit DeprecationWarning (or EncodingWarning which is a subclass of DeprecationWarning) in three versions (Python 3.10~3.12). How do you think this idea? Should we "change all at once" rather than "step-by-step"? Regards, -- Inada Naoki <songofaca...@gmail.com> _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/J5VR56YRXA3PVPUH3KM72OX7SUBAZUKL/ Code of Conduct: http://python.org/psf/codeofconduct/