[Python-ideas] Re: Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-22 Thread Random832
On Fri, Jan 22, 2021, at 20:34, Inada Naoki wrote: > * Default encoding is "utf-8". it might be worthwhile to be a little more sophisticated than this. Notepad itself uses character set detection [it might not be reasonable to do this on the whole file as notepad does, but maybe the first 512 by

[Python-ideas] Re: Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-22 Thread Chris Angelico
On Sat, Jan 23, 2021 at 12:37 PM Inada Naoki wrote: > ## 1. Add `io.open_text()`, builtin `open_text()`, and > `pathlib.Path.open_text()`. > > All functions are same to `io.open()` or `Path.open()`, except: > > * Default encoding is "utf-8". > * "b" is not allowed in the mode option. I *really* d

[Python-ideas] Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-22 Thread Inada Naoki
Hi, all. I am rewriting PEP 597 to introduce a new EncodingWarning, which subclass of DeprecationWarning and used to warn about future default encoding change. But I don't think we can change the default encoding of `io.TextIOWrapper` and built-in `open()` anytime soon. It is disruptive change. It