[Python-ideas] Re: Provide UTF-8 version of Python for Windows.

2021-01-25 Thread Eryk Sun
On 1/26/21, Eryk Sun wrote: > > The process active code page for GetACP() and GetOEMCP() is changed to > UTF-8 (65001). The C runtime also overrides the user locale to UTF-8 > if GetACP() returns UTF-8, i.e. setlocale(LC_CTYPE, "") will return > "utf8" as the encoding. One concern is what to do f

[Python-ideas] Re: Provide UTF-8 version of Python for Windows.

2021-01-25 Thread Inada Naoki
On Tue, Jan 26, 2021 at 4:01 PM Eryk Sun wrote: > > > * Windows team needs to maintain more versions. > > I suppose the installer could install both sets of binaries, and copy > to "python[w][_d].exe" based on an installer option. But then the > UTF-8 selection statistics wouldn't be tracked, unle

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

2021-01-25 Thread Inada Naoki
On Tue, Jan 26, 2021 at 3:07 PM Guido van Rossum wrote: > >> >> I agree that. But until we switch to the default encoding of open(), >> we must recommend to avoid `open(filename)` anyway. >> The default encoding of VS Code, Atom, Notepad is already UTF-8. >> >> Maybe, we need to update the tutoria

[Python-ideas] Re: Provide UTF-8 version of Python for Windows.

2021-01-25 Thread Eryk Sun
On 1/25/21, Inada Naoki wrote: > > Microsoft provides UTF-8 code page for process. It can be enabled by > manifest file. > > How about providing Python binaris both of "UTF-8 version" and "ANSI > version"? I experimented with this manifest setting several months ago. To try it out, simply export

[Python-ideas] Re: Provide UTF-8 version of Python for Windows.

2021-01-25 Thread Random832
On Mon, Jan 25, 2021, at 22:49, William Pickard wrote: > Looks like that's only available for Microsoft Store apps only, so it > might not be viable for Python. I think the "Fusion manifest for an unpackaged Win32 app" part applies to non-store apps. [English version of the page: https://docs.

[Python-ideas] Re: Provide UTF-8 version of Python for Windows.

2021-01-25 Thread Guido van Rossum
Aren't there too many different Windows installers already? I worry that it's too hard to choose which one to use (I know I had to ask another expert :-). On Mon, Jan 25, 2021 at 7:05 PM Inada Naoki wrote: > Sorry for posting multiple threads so quickly. > > Microsoft provides UTF-8 code page fo

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

2021-01-25 Thread Guido van Rossum
On Mon, Jan 25, 2021 at 5:49 PM Inada Naoki wrote: > On Tue, Jan 26, 2021 at 10:22 AM Guido van Rossum > wrote: > > > > > > Older Pythons may be easy to drop, but I'm not so sure about older > unofficial docs. The open() function is very popular and there must be > millions of blog posts with ex

[Python-ideas] Re: Provide UTF-8 version of Python for Windows.

2021-01-25 Thread Inada Naoki
As my understanding, "Fusion manifest for an unpackaged Win32 app" (*) works for non Store Apps too. (*) https://docs.microsoft.com/ja-jp/windows/uwp/design/globalizing/use-utf8-code-page#examples -- Inada Naoki ___ Python-ideas mailing list -- python

[Python-ideas] Re: Provide UTF-8 version of Python for Windows.

2021-01-25 Thread William Pickard
Looks like that's only available for Microsoft Store apps only, so it might not be viable for Python. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/

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

2021-01-25 Thread Matt Wozniski
On Mon, Jan 25, 2021 at 8:51 PM Inada Naoki wrote: > On Tue, Jan 26, 2021 at 10:22 AM Guido van Rossum > wrote: > > Older Pythons may be easy to drop, but I'm not so sure about older > unofficial docs. The open() function is very popular and there must be > millions of blog posts with examples u

[Python-ideas] Provide UTF-8 version of Python for Windows.

2021-01-25 Thread Inada Naoki
Sorry for posting multiple threads so quickly. Microsoft provides UTF-8 code page for process. It can be enabled by manifest file. https://docs.microsoft.com/ja-jp/windows/uwp/design/globalizing/use-utf8-code-page How about providing Python binaris both of "UTF-8 version" and "ANSI version"? This

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

2021-01-25 Thread Inada Naoki
On Tue, Jan 26, 2021 at 10:22 AM Guido van Rossum wrote: > > > Older Pythons may be easy to drop, but I'm not so sure about older unofficial > docs. The open() function is very popular and there must be millions of blog > posts with examples using it, most of them reading text files (written by

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

2021-01-25 Thread Guido van Rossum
On Mon, Jan 25, 2021 at 4:42 PM Steven D'Aprano wrote: > On Sat, Jan 23, 2021 at 09:11:27PM +1100, Chris Angelico wrote: > > > > On the other hand, if we add `open_text()`: > > > > > > * Replacing open with open_text is easier than adding `, > encoding="utf-8"`. > > > * Teachers can teach to use

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

2021-01-25 Thread Steven D'Aprano
On Sat, Jan 23, 2021 at 09:11:27PM +1100, Chris Angelico wrote: > > On the other hand, if we add `open_text()`: > > > > * Replacing open with open_text is easier than adding `, encoding="utf-8"`. > > * Teachers can teach to use `open_text` to open text files. Students > > can use "utf-8" by defaul

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

2021-01-25 Thread Steven D'Aprano
Thanks Matt for the detailed explanation for why we cannot change `open` to do encoding detection by default. I think that should answer Guido's question. It still leaves open the possibility of: - a new mode to open() that opts-in to encoding detection; - a new built-in function that is only

[Python-ideas] Re: dataclass: __init__ kwargs and Optional[type]

2021-01-25 Thread Paul Bryan via Python-ideas
Added myself to the nosy list. Seems like the suggested kw_only: str variant—perhaps it should also support Iterable—would allow continued support for positional arguments. Is your idea around positional-only arguments different?  Another thought  I had was around Optional and default-None semant

[Python-ideas] Re: Changing the default text encoding of pathlib

2021-01-25 Thread Paul Moore
On Mon, 25 Jan 2021 at 20:02, Christopher Barker wrote: > using a system setting as a default is a really bad idea in this day of > interconnected computers. I'd mildly dispute this. There are (significant) downsides with the default behaviour being system-dependent, yes, but there are *also* di

[Python-ideas] Re: Changing the default text encoding of pathlib

2021-01-25 Thread Christopher Barker
On Sun, Jan 24, 2021 at 6:33 PM Inada Naoki wrote: > My previous thread is hijacked about "auto guessing" idea, yes -- I'm a bit confused by that -- are folks advocating for making some sort of encoding detection the default? or available as an option in the stdlib? -- in any case, Ithink that

[Python-ideas] Re: dataclass: __init__ kwargs and Optional[type]

2021-01-25 Thread Eric V. Smith
See https://bugs.python.org/issue33129. I've not done much with this issue, because I'm not crazy about the API, and I'd like to do something with positionally-only arguments at the same time. But I think in general it's a good idea. Eric On 1/24/2021 3:07 PM, Paul Bryan via Python-ideas wrot

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

2021-01-25 Thread Matt Wozniski
On Mon, Jan 25, 2021, 4:25 AM Steven D'Aprano wrote: > On Sun, Jan 24, 2021 at 10:43:54PM -0500, Matt Wozniski wrote: > > And > > `f.read(1)` needs to pick one of those and return it immediately. It > can't > > wait for more information. The contract of `read` is "Read from > underlying > > buffe

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

2021-01-25 Thread Steven D'Aprano
On Sun, Jan 24, 2021 at 10:43:54PM -0500, Matt Wozniski wrote: > On Sun, Jan 24, 2021 at 9:53 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > On 2021-01-25 at 00:29:41 +1100, > > Steven D'Aprano wrote: > > > > > On Sat, Jan 23, 2021 at 03:24:12PM +, Barry Scott wrote: > > > > First probl